This repository has been archived by the owner on Jan 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 484
/
uaa.yml.erb
215 lines (204 loc) · 10.4 KB
/
uaa.yml.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
---
<% uaa_db = properties.uaadb.databases.find { |db| db.tag == "uaa" } %>
<% uaa_role = properties.uaadb.roles.find { |role| role.tag == "admin" } %>
<% protocol = (properties.login && properties.login.protocol) ? properties.login.protocol : "http" %>
<%
# The login secret is defined in one of two properties
# uaa.login.client_secret or uaa.clients.login.secret
# If both of these are defined, then use the latter
if properties.uaa && properties.uaa.clients && properties.uaa.clients.login && properties.uaa.clients.login.secret
login_secret = properties.uaa.clients.login.secret
elsif properties.uaa && properties.uaa.login && properties.uaa.login.client_secret
login_secret = properties.uaa.login.client_secret
else
raise ArgumentError, 'uaa.login.client_secret or uaa.clients.login.secret must be set.'
end
if properties.uaa && properties.uaa.clients && properties.uaa.clients.login
properties.uaa.clients.login.secret = login_secret
end
%>
name: uaa
database:
url: jdbc:<%= properties.uaadb.db_scheme %>://<%= properties.uaadb.address %>:<%= properties.uaadb.port %>/<%= uaa_db.name %>
username: <%= uaa_role.name %>
password: "<%= uaa_role.password %>"
<% if properties.uaa && properties.uaa.ldap && ((properties.uaa.ldap.enabled && (properties.uaa.ldap.enabled==true)) || (properties.uaa.spring_profiles && properties.uaa.spring_profiles.eql?('ldap'))) %>
spring_profiles: <%= properties.uaadb.db_scheme %>,ldap
<% elsif properties.uaa && properties.uaa.spring_profiles && properties.uaa.spring_profiles.include?('ldap') && properties.uaa.ldap %>
spring_profiles: <%= properties.uaa.spring_profiles ? properties.uaa.spring_profiles : properties.uaadb.db_scheme %>
<% elsif properties.login && properties.login.spring_profiles && properties.login.spring_profiles.include?('ldap') && properties.login.ldap && properties.login.ldap.profile_type %>
spring_profiles: <%= properties.uaadb.db_scheme %>,ldap
<% else %>
spring_profiles: <%= properties.uaadb.db_scheme %>
<% end %>
logging:
config: /var/vcap/jobs/uaa/config/log4j.properties
<% if properties.uaa.jwt && properties.uaa.jwt.signing_key && properties.uaa.jwt.verification_key %>
jwt:
token:
signing-key: |
<%= " " + properties.uaa.jwt.signing_key.gsub("\n", "\n ") %>
verification-key: |
<%= " " + properties.uaa.jwt.verification_key.gsub("\n", "\n ") %>
<% elsif properties.uaa.cc && properties.uaa.cc.token_secret %>
jwt:
token:
signing-key: "<%= properties.uaa.cc.token_secret %>"
verification-key: "<%= properties.uaa.cc.token_secret %>"
<% end %>
<% scheme = p("uaa.no_ssl") ? "http" : "https"
domain = p("domain") %>
<% if properties.uaa.authentication && properties.uaa.authentication.policy %>
authentication:
policy:
lockoutAfterFailures: <%= properties.uaa.authentication.policy.lockoutAfterFailures ? properties.uaa.authentication.policy.lockoutAfterFailures : 5%>
countFailuresWithinSeconds: <%= properties.uaa.authentication.policy.countFailuresWithinSeconds ? properties.uaa.authentication.policy.countFailuresWithinSeconds : 3600 %>
lockoutPeriodSeconds: <%= properties.uaa.authentication.policy.lockoutPeriodSeconds ? properties.uaa.authentication.policy.lockoutPeriodSeconds : 300%>
<% end %>
issuer.uri: <%= p("uaa.url", "#{scheme}://uaa.#{domain}") %>
oauth:
<% unless properties.uaa.no_ssl %>
authorize:
ssl: true
<% end %>
client:
<% if properties.uaa.client && properties.uaa.client.autoapprove %>
autoapprove: <% properties.uaa.client.autoapprove.each do |client_id| %>
- <%= client_id %><% end %>
<% else %>
autoapprove:
- cf
- login
- developer_console
- support-signon
<% end %>
clients:
<% if properties.uaa.clients then properties.uaa.clients.marshal_dump.each do |id,client| %>
<% next unless client %>
<%= id %>:<% client.marshal_dump.each do |key,value|%>
<%= key %>: <%= value %><% end %><% end %>
<% end %>
<% if !properties.uaa.clients || !properties.uaa.clients.admin %>
admin:
authorized-grant-types: client_credentials
authorities: clients.read,clients.write,clients.secret,uaa.admin,scim.read,password.write
id: admin
secret: "<%= properties.uaa.admin.client_secret %>"
<% end %>
<% if !properties.uaa.clients || !properties.uaa.clients.cloud_controller %>
cloud_controller:
authorized-grant-types: client_credentials
authorities: scim.read,scim.write,password.write
id: cloud_controller
secret: "<%= properties.uaa.cc.client_secret %>"
access-token-validity: 604800
<% end %>
<% if !properties.uaa.clients || !properties.uaa.clients.cf %>
cf:
id: cf
override: true
authorized-grant-types: implicit,password,refresh_token
scope: cloud_controller.read,cloud_controller.write,openid,password.write,cloud_controller.admin,scim.read,scim.write,scim.userids,doppler.firehose
authorities: uaa.none
access-token-validity: 600
refresh-token-validity: 2592000
<% end %>
<% if !properties.uaa.clients || !properties.uaa.clients.login %>
login:
id: login
override: true
secret: "<%= login_secret %>"
authorized-grant-types: authorization_code,client_credentials,refresh_token
authorities: oauth.login
scope: openid,oauth.approvals
redirect-uri: <%= "#{protocol}://login.#{properties.domain}" %>
<% end %>
user:
authorities: <% properties.uaa.user.authorities.each do |authority| %>
- <%= authority %><% end %>
scim:
userids_enabled: <%= properties.uaa.scim && (!properties.uaa.scim.userids_enabled.nil?) ? properties.uaa.scim.userids_enabled : false %>
user.override: <%= properties.uaa.scim && properties.uaa.scim.user && (!properties.uaa.scim.user.override.nil?) ? properties.uaa.scim.user.override : true %>
<% if properties.uaa.scim && properties.uaa.scim.users then %>
users: <% properties.uaa.scim.users.each do |user| %>
- <%= user %><% end %>
<% end %>
<% if properties.uaa.scim && properties.uaa.scim.external_groups then %>
external_groups: <% properties.uaa.scim.external_groups.each do |group| %>
- <%= group %><% end %>
<% end %>
<% if !properties.uaa.require_https.nil? %>
require_https: <%= properties.uaa.require_https %>
<% end %>
<% if !properties.uaa.dump_requests.nil? %>
dump_requests: <%= properties.uaa.dump_requests %>
<% end %>
<% if properties.uaa && properties.uaa.ldap && ((properties.uaa.ldap.enabled && (properties.uaa.ldap.enabled==true)) || (properties.uaa.spring_profiles && properties.uaa.spring_profiles.include?('ldap'))) %>
ldap:
ldapdebug: 'Ldap configured through UAA'
profile:
file: <%= (properties.uaa.ldap.profile_type == 'simple-bind') ? 'ldap/ldap-simple-bind.xml' : (properties.uaa.ldap.profile_type == 'search-and-bind') ? 'ldap/ldap-search-and-bind.xml' : 'ldap/ldap-search-and-compare.xml' %>
base:
url: '<%= properties.uaa.ldap.url %>'
<% if properties.uaa.ldap.profile_type == 'simple-bind' %>
userDnPattern: '<%= properties.uaa.ldap.userDNPattern %>'
userDnPatternDelimiter: '<%= properties.uaa.ldap.userDNPatternDelimiter%>'
<% else %>
userDn: '<%= properties.uaa.ldap.userDN %>'
password: '<%= properties.uaa.ldap.userPassword %>'
searchBase: '<%= properties.uaa.ldap.searchBase %>'
searchFilter: '<%= properties.uaa.ldap.searchFilter %>'
<% end %>
<% if properties.uaa.ldap.profile_type == 'search-and-compare' %>
passwordAttributeName: <%= properties.uaa.ldap.passwordAttributeName %>
passwordEncoder: <%= properties.uaa.ldap.passwordEncoder %>
localPasswordCompare: <%= properties.uaa.ldap.localPasswordCompare %>
<% end %>
mailAttributeName: '<%= properties.uaa.ldap.mailAttributeName%>'
mailSubstitute: '<%= properties.uaa.ldap.mailSubstitute %>'
mailSubstituteOverridesLdap: <%= properties.uaa.ldap.mailSubstituteOverridesLdap %>
<% if properties.uaa.ldap.sslCertificate %>
ssl:
sslCertificate: ! <%= "'" + p("uaa.ldap.sslCertificate").gsub("\n", "\n\n ") + "'" %>
<% if properties.uaa.ldap.sslCertificateAlias %>
sslCertificateAlias: <%= properties.uaa.ldap.sslCertificateAlias %>
<% end %>
<% end %>
<% if properties.uaa.ldap.groups && properties.uaa.ldap.groups.profile_type %>
groups:
file: <%= (properties.uaa.ldap.groups.profile_type == 'no-groups') ? 'ldap/ldap-groups-null.xml' : (properties.uaa.ldap.groups.profile_type == 'groups-as-scopes') ? 'ldap/ldap-groups-as-scopes.xml' : 'ldap/ldap-groups-map-to-scopes.xml' %>
searchBase: '<%= properties.uaa.ldap.groups.searchBase %>'
groupRoleAttribute: '<%= (properties.uaa.ldap.groups.profile_type == 'groups-as-scopes') ? properties.uaa.ldap.groups.groupRoleAttribute : 'spring.security.ldap.dn' %>'
groupSearchFilter: '<%= properties.uaa.ldap.groups.groupSearchFilter %>'
searchSubtree: <%= properties.uaa.ldap.groups.searchSubtree %>
maxSearchDepth: <%= properties.uaa.ldap.groups.maxSearchDepth %>
autoAdd: <%= properties.uaa.ldap.groups.autoAdd %>
<% end %>
<% elsif properties.login && properties.login.spring_profiles && properties.login.spring_profiles.include?('ldap') && properties.login.ldap && properties.login.ldap.profile_type %>
ldap:
ldapdebug: 'Ldap configured through Login Server'
profile:
file: <%= (properties.login.ldap.profile_type == 'simple-bind') ? 'ldap/ldap-simple-bind.xml' : (properties.login.ldap.profile_type == 'search-and-bind') ? 'ldap/ldap-search-and-bind.xml' : 'ldap/ldap-search-and-compare.xml' %>
base:
url: '<%= properties.login.ldap.url %>'
<% if properties.login.ldap.profile_type == 'simple-bind' %>
userDnPattern: '<%= properties.login.ldap.userDNPattern %>'
<% else %>
userDn: '<%= properties.login.ldap.userDN %>'
password: '<%= properties.login.ldap.userPassword %>'
searchBase: '<%= properties.login.ldap.searchBase %>'
searchFilter: '<%= properties.login.ldap.searchFilter %>'
<% end %>
<% if properties.login.ldap.profile_type == 'search-and-compare' %>
passwordAttributeName: <%= properties.login.ldap.passwordAttributeName %>
passwordEncoder: <%= properties.login.ldap.passwordEncoder %>
localPasswordCompare: <%= properties.login.ldap.localPasswordCompare %>
<% end %>
<% if properties.login.ldap.sslCertificate %>
ssl:
sslCertificate: ! <%= "'" + p("login.ldap.sslCertificate").gsub("\n", "\n\n ") + "'" %>
<% if properties.login.ldap.sslCertificateAlias %>
sslCertificateAlias: <%= properties.login.ldap.sslCertificateAlias %>
<% end %>
<% end %>
<% end %>