Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 508 lines (368 sloc) 18.381 kB
39b9174 @tekul Minor edit to README.md (review test)
tekul authored
1 <link href="https://raw.github.com/clownfart/Markdown-CSS/master/markdown.css" rel="stylesheet"></link>
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
2 # CloudFoundry User Account and Authentication (UAA) Server
ace5777 @daleolds start of UAA
daleolds authored
3
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
4 The UAA is the identity management service for Cloud Foundry. It's
5 primary role is as an OAuth2 provider, issuing tokens for client
6 applications to use when they act on behalf of Cloud Foundry users.
7 It can also authenticate users with their Cloud Foundry credentials,
8 and can act as an SSO service using those credentials (or others). It
9 has endpoints for managing user accounts and for registering OAuth2
10 clients, as well as various other management functions.
11
d117c68 @dsyer Add useful listings to README
dsyer authored
12 ## Co-ordinates
13
67f369f @tekul CFID-101: Use Apache http client in LegacyAuthenticationManager.
tekul authored
14 * Team:
d117c68 @dsyer Add useful listings to README
dsyer authored
15 * Dale Olds (`olds@vmware.com`)
16 * Dave Syer (`dsyer@vmware.com`)
17 * Luke Taylor (`ltaylor@vmware.com`)
18 * Joel D'Sa (`jdsa@vmware.com`)
c68ad47 @tekul CFID-374: Add password strength API to UAA API doc.
tekul authored
19 * Vidya Valmikinathan
20 * Technical forum: [vcap-dev google group](https://groups.google.com/a/cloudfoundry.org/forum/?fromgroups#!forum/vcap-dev)
f2a6532 @dsyer Fix link to docs in README to work with github
dsyer authored
21 * Docs: [docs/](https://github.com/cloudfoundry/uaa/tree/master/docs)
d117c68 @dsyer Add useful listings to README
dsyer authored
22
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
23 ## Quick Start
ace5777 @daleolds start of UAA
daleolds authored
24
ab32020 @dsyer Update README
dsyer authored
25 If this works you are in business:
ace5777 @daleolds start of UAA
daleolds authored
26
8f3fdfa @dsyer CFID-260: change vmware-ac to cloudfoundry
dsyer authored
27 $ git clone git@github.com:cloudfoundry/uaa.git
ab32020 @dsyer Update README
dsyer authored
28 $ cd uaa
29 $ mvn install
39b9174 @tekul Minor edit to README.md (review test)
tekul authored
30
00cf04c @dsyer Simplify integration test incantation
dsyer authored
31 Each module has a `mvn tomcat:run` target to run individually, or you
32 could import them as projects into STS (use 2.8.0 or better if you
33 can). The apps all work together the apps running on the same port
917374e @dsyer CFID-228: extract common JAR (now requires Maven 3 for tomcat)
dsyer authored
34 (8080) as `/uaa`, `/app` and `/api`. You can probably use Maven 2.2.1
afc88bb @dsyer CFID-257: Tidy README and API docs and add extra instructions for ins…
dsyer authored
35 to build the code, but you need to use Maven 3 if you want to run the
36 server from the command line (or run integration tests).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
37
96aa258 Update README to include Bug filing info per Deepika
Chloe Jackson authored
38 ### Deploy to Cloud Foundry
bb43295 @dsyer Add vmc push instructions
dsyer authored
39
40 You can also build the app and push it to Cloud Foundry, e.g.
41
42 $ mvn install
43 $ vmc push myuaa --path uaa/target
44
45 (If you do that, choose a unique application id, not 'myuaa'.)
46
47 ### Demo of command line usage on local server
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
48
73e67fa @andypiper clarified documentation and explained how to run gem against cloud fo…
andypiper authored
49 First run the UAA server as described above:
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
50
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
51 $ cd uaa
00cf04c @dsyer Simplify integration test incantation
dsyer authored
52 $ mvn tomcat:run
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
53
73e67fa @andypiper clarified documentation and explained how to run gem against cloud fo…
andypiper authored
54 Then start another terminal and from the project base directory, ask
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
55 the login endpoint to tell you about the system:
56
57 $ curl -H "Accept: application/json" localhost:8080/uaa/login
58 {
59 "timestamp":"2012-03-28T18:25:49+0100",
60 "commit_id":"111274e",
61 "prompts":{"username":["text","Username"],
62 "password":["password","Password"]
63 }
64 }
65
66 Then you can try logging in with the UAA ruby gem. Make sure you have
67 ruby 1.9, and bundler installed, then
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
68
73e67fa @andypiper clarified documentation and explained how to run gem against cloud fo…
andypiper authored
69 $ cd gem/; bundle
def3acb @dsyer Update README for uaac (new gem)
dsyer authored
70 $ ./bin/uaac target http://localhost:8080/uaa vmc
71 $ ./bin/uaac login implicit marissa koala
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
72
ff93493 @dsyer CFID-76: Tidy up login and add some rdocs
dsyer authored
73 (or leave out the username / password to be prompted).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
74
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
75 This authenticates and obtains an access token from the server using
76 the OAuth2 implicit grant, similar to the approach intended for a
def3acb @dsyer Update README for uaac (new gem)
dsyer authored
77 client like VMC. The token is stored in `~/.uuac.yml`, so dig into
78 that file and pull out the access token for your `vmc` target (or use
79 `--verbose` on the login command line above to see it logged to your
80 console).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
81
def3acb @dsyer Update README for uaac (new gem)
dsyer authored
82 Then you can login as a resource server and retrieve the token
83 details:
84
85 $ ./bin/uaac target http://localhost:8080/uaa app
86 $ ./bin/uaac login token [token-value-from-above]
ff93493 @dsyer CFID-76: Tidy up login and add some rdocs
dsyer authored
87
def3acb @dsyer Update README for uaac (new gem)
dsyer authored
88 You will be prompted for the client secret (`appclientsecret`), and
89 then you should see your username and the client id of the original
90 token grant on stdout, e.g.
91
c68ad47 @tekul CFID-374: Add password strength API to UAA API doc.
tekul authored
92 id: 6e1ac414-f446-4869-9b41-41f1f41b96df
def3acb @dsyer Update README for uaac (new gem)
dsyer authored
93 resource-ids:
94 - tokens
95 - openid
96 - cloud_controller
97 - password
98 expires-at: 1339120767
99 scope:
100 - read
101 - write
102 - openid
103 - password
104 email: marissa@test.org
105 client-authorities:
106 - ROLE_UNTRUSTED
107 expires-in: 43158
108 user-authorities:
109 - uaa.user
110 user-id: marissa
111 client-id: vmc
112 token-id: 90162e5c-228d-4620-b457-83e2d591eedf
73e67fa @andypiper clarified documentation and explained how to run gem against cloud fo…
andypiper authored
113
bb43295 @dsyer Add vmc push instructions
dsyer authored
114 ### Demo of command line usage on cloudfoundry.com
73e67fa @andypiper clarified documentation and explained how to run gem against cloud fo…
andypiper authored
115
def3acb @dsyer Update README for uaac (new gem)
dsyer authored
116 The same command line example should work against a UAA running on
117 cloudfoundry.com (except for the token decoding bit because you won't
118 have the client secret). In this case, there is no need to run a local
119 uaa server, so simply ask the external login endpoint to tell you
120 about the system:
73e67fa @andypiper clarified documentation and explained how to run gem against cloud fo…
andypiper authored
121
122 $ curl -H "Accept: application/json" uaa.cloudfoundry.com/login
123 {
124 "prompts":{"username":["text","Username"],
125 "password":["password","Password"]
126 }
127 }
128
129 You can then try logging in with the UAA ruby gem. Make sure you have ruby 1.9, and bundler installed, then
130
131 $ cd gem/; bundle
def3acb @dsyer Update README for uaac (new gem)
dsyer authored
132 $ ./bin/uaac target uaa.cloudfoundry.com vmc
133 $ ./bin/uaac login implicit [yourusername] [yourpassword]
73e67fa @andypiper clarified documentation and explained how to run gem against cloud fo…
andypiper authored
134
135 (or leave out the username / password to be prompted).
136
137 This authenticates and obtains an access token from the server using the OAuth2 implicit
def3acb @dsyer Update README for uaac (new gem)
dsyer authored
138 grant, the same as used by a client like VMC.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
139
6bab6c9 @dsyer Put tomcat in a profile (tomcat)
dsyer authored
140 ## Integration tests
141
142 With all apps deployed into a running server on port 8080 the tests
143 will include integration tests (a check is done before each test that
144 the app is running). You can deploy them in your IDE or using the
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
145 command line with `mvn tomcat:run` and then run the tests as normal.
6bab6c9 @dsyer Put tomcat in a profile (tomcat)
dsyer authored
146
00cf04c @dsyer Simplify integration test incantation
dsyer authored
147 For individual modules, or for the whole project, you can also run
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
148 integration tests and the server from the command line in one go with
6bab6c9 @dsyer Put tomcat in a profile (tomcat)
dsyer authored
149
917374e @dsyer CFID-228: extract common JAR (now requires Maven 3 for tomcat)
dsyer authored
150 $ mvn test -P integration
6bab6c9 @dsyer Put tomcat in a profile (tomcat)
dsyer authored
151
28afa21 @dsyer Remove or tidy jsps and update README
dsyer authored
152 (This might require an initial `mvn install` from the parent directory
153 to get the wars in your local repo first.)
154
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
155 To make the tests work in various environments you can modify the
156 configuration of the server and the tests (e.g. the admin client)
157 using a variety of mechanisms. The simplest is to provide additional
158 Maven profiles on the command line, e.g.
159
160 $ (cd uaa; mvn test -P vcap)
161
162 will run the integration tests against a uaa server running in a local
163 vcap, so for example the service URL is set to `uaa.vcap.me` (by
164 default). There are several Maven profiles to play with, and they can
165 be used to run the server, or the tests or both:
166
167 * `local`: runs the server on the ROOT context `http://localhost:8080/`
168
169 * `vcap`: also runs the server on the ROOT context and points the
170 tests at `uaa.vcap.me`.
171
172 * `devuaa`: points the tests at `http://devuaa.cloudfoundry.com` (an
173 instance of UAA deployed on cloudfoundry).
174
175 All these profiles set the `CLOUD_FOUNDRY_CONFIG_PATH` to pick up a
176 `uaa.yml` and (if appropriate) set the context root for running the
177 server (see below for more detail on that).
178
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
179 ### BVTs
180
181 There is a really simple cucumber feature spec (`--tag @uaa`) to
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
182 verify that the UAA server is there. There is also a rake task to
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
183 launch the integration tests from the `uaa` submodule in `vcap`.
184 Typical usage for a local (`uaa.vcap.me`) instance:
185
186 $ cd vcap/tests
187 $ rake bvt:run_uaa
188
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
189 You can change the most common important settings with environment
190 variables (see below), or with a custom `uaa.yml`. N.B. `MAVEN_OPTS`
191 cannot be used to set JVM system properties for the tests, but it can
192 be used to set memory limits for the process etc.
193
194 ### Custom YAML Configuration
195
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
196 To modify the runtime parameters you can provide a `uaa.yml`, e.g.
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
197
198 $ cat > /tmp/uaa.yml
199 uaa:
200 host: uaa.appcloud21.dev.mozycloud
201 test:
202 username: dev@cloudfoundry.org # defaults to vcap_tester@vmware.com
203 password: changeme
204 email: dev@cloudfoundry.org
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
205
206 then from `vcap-tests`
207
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
208 $ CLOUD_FOUNDRY_CONFIG_PATH=/tmp rake bvt:run_uaa
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
209
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
210 or from `uaa/uaa`
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
211
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
212 $ CLOUD_FOUNDRY_CONFIG_PATH=/tmp mvn test
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
213
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
214 The integration tests look for a Yaml file in the following locations
215 (later entries override earlier ones), and the webapp does the same
216 when it starts up so you can use the same config file for both:
217
218 classpath:uaa.yml
219 file:${CLOUD_FOUNDRY_CONFIG_PATH}/uaa.yml
220 file:${UAA_CONFIG_FILE}
221 ${UAA_CONFIG_URL}
222
223 ### Using Maven with Cloud Foundry or VCAP
224
225 To test against a vcap instance use the Maven profile `vcap` (it
226 switches off some of the tests that create random client and user
227 accounts):
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
228
229 $ (cd uaa; mvn test -P vcap)
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
230
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
231 To change the target server it should suffice to set
f1d1a89 @dsyer CFID-230: update UAA docs
dsyer authored
232 `VCAP_BVT_TARGET` (the tests prefix it with `uaa.` to form the
917374e @dsyer CFID-228: extract common JAR (now requires Maven 3 for tomcat)
dsyer authored
233 server url), e.g.
234
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
235 $ VCAP_BVT_TARGET=appcloud21.dev.mozycloud mvn test -P vcap
236
237 You can also override some of the other most important default
238 settings using environment variables. The defaults as usual come from
239 `uaa.yml` but tests will search first in an environment variable:
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
240
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
241 * `UAA_ADMIN_CLIENT_ID` the client id for bootstrapping client
242 registrations needed for the rest of the tests.
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
243
3314a09 @tekul Fix some doc typos
tekul authored
244 * `UAA_ADMIN_CLIENT_SECRET` the client secret for bootstrapping client
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
245 registrations
246
3314a09 @tekul Fix some doc typos
tekul authored
247 All other settings from `uaa.yml` can be overridden individually as
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
248 system properties. Running in an IDE this is easy just using whatever
249 features allow you to modify the JVM in test runs, but using Maven you
250 have to use the `argLine` property to get settings passed onto the
251 test JVM, e.g.
252
253 $ mvn -DargLine=-Duaa.test.username=foo test
254
255 will create an account with `userName=foo` for testing (instead using
256 the default setting from `uaa.yml`).
257
258 If you prefer environment variables to system properties you can use a
259 custom `uaa.yml` with placeholders for your environment variables,
260 e.g.
261
262 uaa:
263 test:
264 username: ${UAA_TEST_USERNAME:marissa}
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
265
fb10cbe @dsyer CFID-233,CFID-214: changes in SECOAUTH require updates to config, and…
dsyer authored
266 will look for an environment variable (or system property)
267 `UAA_TEST_USERNAME` before defaulting to `marissa`. This is the trick
268 used to expose `UAA_ADMIN_CLIENT_SECRET` etc. in the standard
269 configuration.
e962246 @dsyer CFID-105: tweak tests and update README for BVT changes
dsyer authored
270
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
271 ## Inventory
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
272
60e128a @dsyer Add postgres support and and check with PLATFORM=postgresql
dsyer authored
273 There are actually several projects here, the main `uaa` server application and some samples:
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
274
917374e @dsyer CFID-228: extract common JAR (now requires Maven 3 for tomcat)
dsyer authored
275 0. `common` is a module containing a JAR with all the business logic. It is used in
276 the webapps below.
277
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
278 1. `uaa` is the actual UAA server
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
279
0c65ef3 @joeldsa Changed the name of the gem to cf-uaa-client
joeldsa authored
280 2. `gem` is a ruby gem (`cf-uaa-client`) for interacting with the UAA server
ff93493 @dsyer CFID-76: Tidy up login and add some rdocs
dsyer authored
281
282 3. `api` (sample) is an OAuth2 resource service which returns a mock list of deployed apps
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
283
ff93493 @dsyer CFID-76: Tidy up login and add some rdocs
dsyer authored
284 4. `app` (sample) is a user application that uses both of the above
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
285
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
286 5. `login` (sample) is an application that performs authentication for the UAA acting as a back end service
287
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
288 In CloudFoundry terms
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
289
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
290 * `uaa` provides an authentication service plus authorized delegation for
291 back-end services and apps (by issuing OAuth2 access tokens).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
292
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
293 * `api` is `api.cloudfoundry.com` - it's a service which provides resources
294 which other applications may wish to access on behalf of the resource
295 owner (the end user).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
296
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
297 * `app` is `code.cloudfoundry.com` or `studio.cloudfoundry.com` - a
298 webapp that needs single sign on and access to the `api` service on
299 behalf of users.
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
300
301 * `login` is where Cloud Foundry administrators set up their
302 authentication sources, e.g. LDAP/AD, SAML, OpenID (Google etc.) or
76ada2b @dsyer [cfid-337] Remove login sample
dsyer authored
303 social. The cloudfoundry.com platform uses a different
304 implementation of the
305 [login server](https://github.com/cloudfoundry/login-server).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
306
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
307 ## UAA Server
308
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
309 The authentication service is `uaa`. It's a plain Spring MVC webapp.
310 Deploy as normal in Tomcat or your container of choice, or execute
afc88bb @dsyer CFID-257: Tidy README and API docs and add extra instructions for ins…
dsyer authored
311 `mvn tomcat:run` to run it directly from `uaa` directory in the source
312 tree (make sure the common jar is installed first using `mvn install`
313 from the common subdirectory or from the top level directory). When
314 running with maven it listens on port 8080.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
315
afc88bb @dsyer CFID-257: Tidy README and API docs and add extra instructions for ins…
dsyer authored
316 The UAA Server supports the APIs defined in the UAA-APIs document. To summarise:
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
317
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
318 1. The OAuth2 /authorize and /token endpoints
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
319
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
320 2. A /login_info endpoint to allow querying for required login prompts
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
321
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
322 3. A /check_token endpoint, to allow resource servers to obtain information about
323 an access token submitted by an OAuth2 client.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
324
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
325 4. SCIM user provisioning endpoint
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
326
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
327 5. OpenID connect endpoints to support authentication /userinfo and
328 /check_id (todo). Implemented roughly enough to get it working (so
329 /app authenticates here), but not to meet the spec.
e578bc0 @dsyer CFID-36: tidy up and add some docs
dsyer authored
330
331 Authentication can be performed by command line clients by submitting
60e128a @dsyer Add postgres support and and check with PLATFORM=postgresql
dsyer authored
332 credentials directly to the `/authorize` endpoint (as described in
e578bc0 @dsyer CFID-36: tidy up and add some docs
dsyer authored
333 UAA-API doc). There is an `ImplicitAccessTokenProvider` in Spring
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
334 Security OAuth that can do the heavy lifting if your client is Java.
335
336 By default `uaa` will launch with a context root `/uaa`. There is a
afc88bb @dsyer CFID-257: Tidy README and API docs and add extra instructions for ins…
dsyer authored
337 Maven profile `local` to launch with context root `/`, and another
338 called `vcap` to launch at `/` with a postgresql backend.
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
339
ff268de @dsyer CFID-96: remove private profile and initialise empty database with ad…
dsyer authored
340 ### Configuration
341
342 There is a `uaa.yml` in the application which provides defaults to the
343 placeholders in the Spring XML. Wherever you see
344 `${placeholder.name}` in the XML there is an opportunity to override
345 it either by providing a System property (`-D` to JVM) with the same
afc88bb @dsyer CFID-257: Tidy README and API docs and add extra instructions for ins…
dsyer authored
346 name, or a custom `uaa.yml` (as described above).
ff268de @dsyer CFID-96: remove private profile and initialise empty database with ad…
dsyer authored
347
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
348 All passwords and client secrets in the config files are plain text,
349 but they will be inserted into the UAA database encrypted with BCrypt.
ff268de @dsyer CFID-96: remove private profile and initialise empty database with ad…
dsyer authored
350
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
351 ### User Account Data
352
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
353 The default is to use an in-memory RDBMS user store that is
354 pre-populated with a single test users: `marissa` has password
355 `koala`.
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
356
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
357 To use Postgresql for user data, activate one of the Spring profiles
358 `hsqldb` or `postgresql`.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
359
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
360 The active profiles can be configured in `uaa.yml` using
361
362 spring_profiles: postgresql
363
364 or by passing the `spring.profiles.active` parameter to the JVM. For,
365 example to run with an embedded HSQL database:
8c2d455 @tekul Added spring profile usage info to readme
tekul authored
366
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
367 mvn -Dspring.profiles.active=hsqldb tomcat:run
8c2d455 @tekul Added spring profile usage info to readme
tekul authored
368
369 Or to use PostgreSQL instead of HSQL:
370
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
371 mvn -Dspring.profiles.active=postgresql tomcat:run
67f369f @tekul CFID-101: Use Apache http client in LegacyAuthenticationManager.
tekul authored
372
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
373 To bootstrap a microcloud type environment you need an admin client.
ff268de @dsyer CFID-96: remove private profile and initialise empty database with ad…
dsyer authored
374 For this there is a database initializer component that inserts an
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
375 admin client. If the default profile is active (i.e. not
376 `postgresql`) there is also a `vmc` client so that the gem login works
377 out of the box. You can override the default settings and add
378 additional clients in `uaa.yml`:
379
380 oauth:
381 clients:
382 admin:
383 authorized-grant-types: client_credentials
384 scope: read,write,password
f1d1a89 @dsyer CFID-230: update UAA docs
dsyer authored
385 authorities: ROLE_CLIENT,ROLE_ADIN
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
386 id: admin
387 secret: adminclientsecret
388 resource-ids: clients
389
390 The admin client can be used to create additional clients (but not to
391 do anything much else). A client with read/write access to the `scim`
392 resource will be needed to create user accounts. The integration
393 tests take care of this automatically, inserting client and user
394 accounts as necessary to make the tests work.
8c2d455 @tekul Added spring profile usage info to readme
tekul authored
395
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
396 ## The API Application
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
397
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token…
tekul authored
398 An example resource server. It hosts a service which returns
399 a list of mock applications under `/apps`.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
400
00cf04c @dsyer Simplify integration test incantation
dsyer authored
401 Run it using `mvn tomcat:run` from the `api` directory (once all other
402 tomcat processes have been shutdown). This will deploy the app to a
403 Tomcat manager on port 8080.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
404
405 ## The App Application
406
39b9174 @tekul Minor edit to README.md (review test)
tekul authored
407 This is a user interface app (primarily aimed at browsers) that uses
e578bc0 @dsyer CFID-36: tidy up and add some docs
dsyer authored
408 OpenId Connect for authentication (i.e. SSO) and OAuth2 for access
409 grants. It authenticates with the Auth service, and then accesses
00cf04c @dsyer Simplify integration test incantation
dsyer authored
410 resources in the API service. Run it with `mvn tomcat:run` from the
411 `app` directory (once all other tomcat processes have been shutdown).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
412
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
413 The application can operate in multiple different profiles according
414 to the location (and presence) of the UAA server and the Login
415 application. By default it will look for a UAA on
416 `localhost:8080/uaa`, but you can change this by setting an
417 environment variable (or System property) called `UAA_PROFILE`. In
418 the application source code (`src/main/resources`) you will find
419 multiple properties files pre-configured with different likely
420 locations for those servers. They are all in the form
421 `application-<UAA_PROFILE>.properties` and the naming convention
422 adopted is that the `UAA_PROFILE` is `local` for the localhost
423 deployment, `vcap` for a `vcap.me` deployment, `staging` for a staging
424 deployment (inside VMware VPN), etc. The profile names are double
425 barrelled (e.g. `local-vcap` when the login server is in a different
426 location than the UAA server).
427
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
428 ### Use Cases
429
ab32020 @dsyer Update README
dsyer authored
430 1. See all apps
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
431
39b9174 @tekul Minor edit to README.md (review test)
tekul authored
432 GET /app/apps
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
433
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
434 browser is redirected through a series of authentication and
435 access grant steps (which could be slimmed down to implicit steps
436 not requiring user at some point), and then the photos are shown.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
437
ab32020 @dsyer Update README
dsyer authored
438 2. See the currently logged in user details, a bag of attributes
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
439 grabbed from the open id provider
440
ab32020 @dsyer Update README
dsyer authored
441 GET /app
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
442
443 ## The Login Application
444
445 A user interface for authentication. The UAA can also authenticate
446 user accounts, but only if it manages them itself, and it only
447 provides a basic UI. The Login app can be branded and customized for
448 non-native authentication and for more complicate UI flows, like user
449 registration and password reset.
450
451 The login application is actually itself an OAuth2 endpoint provider,
452 but delegates those features to the UAA server. Configuration for the
453 login application therefore consists of locating the UAA through its
454 OAuth2 endpoint URLs, and registering the login application itself as
455 a client of the UAA. There is a `login.yml` for the UAA locations,
456 e.g. for a local `vcap` instance:
457
458 uaa:
459 url: http://uaa.vcap.me
460 token:
461 url: http://uaa.vcap.me/oauth/token
462 login:
463 url: http://uaa.vcap.me/login.do
464
465 and there is an environment variable (or Java System property),
466 `LOGIN_SECRET` for the client secret that the app uses when it
467 authenticates itself with the UAA. The Login app is registered by
468 default in the UAA only if there are no active Spring profiles (so not
3314a09 @tekul Fix some doc typos
tekul authored
469 at all in `vcap`). In the UAA you can find the registration in the
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
470 `oauth-clients.xml` config file. Here's a summary:
471
c68ad47 @tekul CFID-374: Add password strength API to UAA API doc.
tekul authored
472 id: login
473 secret: loginsecret
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
474 authorized-grant-types: client_credentials
c68ad47 @tekul CFID-374: Add password strength API to UAA API doc.
tekul authored
475 authorities: ROLE_LOGIN
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
476 resource-ids: oauth
477
478 ### Use Cases
479
480 1. Authenticate
481
482 GET /login
483
484 The sample app presents a form login interface for the backend
485 UAA, and also an OpenID widget so the user can authenticate using
486 Google etc. credentials.
487
488 2. Approve OAuth2 token grant
489
490 GET /oauth/authorize?client_id=app&response_type=code...
491
492 Standard OAuth2 Authorization Endpoint. Client credentials and
493 all other features are handled by the UAA in the back end, and the
494 login application is used to render the UI (see
495 `access_confirmation.jsp`).
496
497 3. Obtain access token
498
499 POST /oauth/token
500
501 Standard OAuth2 Authorization Endpoint passed through to the UAA.
96aa258 Update README to include Bug filing info per Deepika
Chloe Jackson authored
502
503 ## File a Bug
504
505 To file a bug against Cloud Foundry Open Source and its components, sign up and use our
506 bug tracking system: [http://cloudfoundry.atlassian.net](http://cloudfoundry.atlassian.net)
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
507
Something went wrong with that request. Please try again.