Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 536 lines (388 sloc) 19.573 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 gr...
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
8cefad2 @tekul Minor update to README.
tekul 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
3471d8f @bmidgley documentation updates uaac etc
bmidgley authored
34 (8080) as `/uaa`, `/app` and `/api`.
35
36 You will need Maven 3.0.4 or newer.
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
3471d8f @bmidgley documentation updates uaac etc
bmidgley authored
42 $ mvn package install
bb43295 @dsyer Add vmc push instructions
dsyer authored
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 found...
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 gr...
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 found...
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 found...
andypiper authored
69 $ cd gem/; bundle
3471d8f @bmidgley documentation updates uaac etc
bmidgley authored
70 $ ./bin/uaac target http://localhost:8080/uaa
71 $ ./bin/uaac token get 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 sp...
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 found...
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 found...
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 found...
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 found...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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 sp...
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
b7df865 @joeldsa Enable the mysql profile and fix unit tests to work with mysql
joeldsa authored
271 ### Using Maven with to test with postgresql or mysql
272
273 The default uaa unit tests (mvn test) use hsqldb.
274
275 To run the unit tests using postgresql:
276
277 $ SPRING_PROFILES_ACTIVE=test,postgresql CLOUD_FOUNDRY_CONFIG_PATH=src/test/resources/test/profiles/postgresql mvn test
278
279 To run the unit tests using mysql:
280
281 $ SPRING_PROFILES_ACTIVE=test,mysql CLOUD_FOUNDRY_CONFIG_PATH=src/test/resources/test/profiles/mysql mvn test
282
283 The database configuration for the common and scim modules is located at:
284 common/src/test/resources/(mysql|postgresql).properties
285 scim/src/test/resources/(mysql|postgresql).properties
286
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
287 ## Inventory
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
288
60e128a @dsyer Add postgres support and and check with PLATFORM=postgresql
dsyer authored
289 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
290
917374e @dsyer CFID-228: extract common JAR (now requires Maven 3 for tomcat)
dsyer authored
291 0. `common` is a module containing a JAR with all the business logic. It is used in
292 the webapps below.
293
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
294 1. `uaa` is the actual UAA server
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
295
0c65ef3 @joeldsa Changed the name of the gem to cf-uaa-client
joeldsa authored
296 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
297
298 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
299
ff93493 @dsyer CFID-76: Tidy up login and add some rdocs
dsyer authored
300 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
301
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
302 5. `login` (sample) is an application that performs authentication for the UAA acting as a back end service
303
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
304 In CloudFoundry terms
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
305
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
306 * `uaa` provides an authentication service plus authorized delegation for
307 back-end services and apps (by issuing OAuth2 access tokens).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
308
f6a4503 @joeldsa Remove legacy application examples from the README
joeldsa authored
309 * `api` is a service that provides resources that other applications may
310 wish to access on behalf of the resource owner (the end user).
311
312 * `app` is a webapp that needs single sign on and access to the `api`
313 service on behalf of users.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
314
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
315 * `login` is where Cloud Foundry administrators set up their
316 authentication sources, e.g. LDAP/AD, SAML, OpenID (Google etc.) or
76ada2b @dsyer [cfid-337] Remove login sample
dsyer authored
317 social. The cloudfoundry.com platform uses a different
318 implementation of the
319 [login server](https://github.com/cloudfoundry/login-server).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
320
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
321 ## UAA Server
322
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
323 The authentication service is `uaa`. It's a plain Spring MVC webapp.
324 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 instal...
dsyer authored
325 `mvn tomcat:run` to run it directly from `uaa` directory in the source
326 tree (make sure the common jar is installed first using `mvn install`
327 from the common subdirectory or from the top level directory). When
328 running with maven it listens on port 8080.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
329
afc88bb @dsyer CFID-257: Tidy README and API docs and add extra instructions for instal...
dsyer authored
330 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
331
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
332 1. The OAuth2 /authorize and /token endpoints
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
333
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
334 2. A /login_info endpoint to allow querying for required login prompts
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
335
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
336 3. A /check_token endpoint, to allow resource servers to obtain information about
337 an access token submitted by an OAuth2 client.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
338
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
339 4. SCIM user provisioning endpoint
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
340
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
341 5. OpenID connect endpoints to support authentication /userinfo and
342 /check_id (todo). Implemented roughly enough to get it working (so
343 /app authenticates here), but not to meet the spec.
e578bc0 @dsyer CFID-36: tidy up and add some docs
dsyer authored
344
345 Authentication can be performed by command line clients by submitting
60e128a @dsyer Add postgres support and and check with PLATFORM=postgresql
dsyer authored
346 credentials directly to the `/authorize` endpoint (as described in
e578bc0 @dsyer CFID-36: tidy up and add some docs
dsyer authored
347 UAA-API doc). There is an `ImplicitAccessTokenProvider` in Spring
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
348 Security OAuth that can do the heavy lifting if your client is Java.
349
350 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 instal...
dsyer authored
351 Maven profile `local` to launch with context root `/`, and another
352 called `vcap` to launch at `/` with a postgresql backend.
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
353
ff268de @dsyer CFID-96: remove private profile and initialise empty database with admin...
dsyer authored
354 ### Configuration
355
356 There is a `uaa.yml` in the application which provides defaults to the
357 placeholders in the Spring XML. Wherever you see
358 `${placeholder.name}` in the XML there is an opportunity to override
359 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 instal...
dsyer authored
360 name, or a custom `uaa.yml` (as described above).
ff268de @dsyer CFID-96: remove private profile and initialise empty database with admin...
dsyer authored
361
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
362 All passwords and client secrets in the config files are plain text,
363 but they will be inserted into the UAA database encrypted with BCrypt.
ff268de @dsyer CFID-96: remove private profile and initialise empty database with admin...
dsyer authored
364
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
365 ### User Account Data
366
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
367 The default is to use an in-memory RDBMS user store that is
368 pre-populated with a single test users: `marissa` has password
369 `koala`.
92647e4 @dsyer Upgrade to Spring 3.1
dsyer authored
370
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
371 To use Postgresql for user data, activate one of the Spring profiles
372 `hsqldb` or `postgresql`.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
373
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
374 The active profiles can be configured in `uaa.yml` using
375
376 spring_profiles: postgresql
377
378 or by passing the `spring.profiles.active` parameter to the JVM. For,
379 example to run with an embedded HSQL database:
8c2d455 @tekul Added spring profile usage info to readme
tekul authored
380
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
381 mvn -Dspring.profiles.active=hsqldb tomcat:run
8c2d455 @tekul Added spring profile usage info to readme
tekul authored
382
383 Or to use PostgreSQL instead of HSQL:
384
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
385 mvn -Dspring.profiles.active=postgresql tomcat:run
67f369f @tekul CFID-101: Use Apache http client in LegacyAuthenticationManager.
tekul authored
386
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
387 To bootstrap a microcloud type environment you need an admin client.
ff268de @dsyer CFID-96: remove private profile and initialise empty database with admin...
dsyer authored
388 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
389 admin client. If the default profile is active (i.e. not
390 `postgresql`) there is also a `vmc` client so that the gem login works
391 out of the box. You can override the default settings and add
392 additional clients in `uaa.yml`:
393
394 oauth:
395 clients:
396 admin:
397 authorized-grant-types: client_credentials
398 scope: read,write,password
f1d1a89 @dsyer CFID-230: update UAA docs
dsyer authored
399 authorities: ROLE_CLIENT,ROLE_ADIN
07d4762 @dsyer CFID-41, CFID-214: again don't make any assumptions about the database
dsyer authored
400 id: admin
401 secret: adminclientsecret
402 resource-ids: clients
403
404 The admin client can be used to create additional clients (but not to
405 do anything much else). A client with read/write access to the `scim`
406 resource will be needed to create user accounts. The integration
407 tests take care of this automatically, inserting client and user
408 accounts as necessary to make the tests work.
8c2d455 @tekul Added spring profile usage info to readme
tekul authored
409
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
410 ## The API Application
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
411
3c3c502 @tekul Update README and scripts to illustrate the implicit flow login/token gr...
tekul authored
412 An example resource server. It hosts a service which returns
413 a list of mock applications under `/apps`.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
414
00cf04c @dsyer Simplify integration test incantation
dsyer authored
415 Run it using `mvn tomcat:run` from the `api` directory (once all other
416 tomcat processes have been shutdown). This will deploy the app to a
417 Tomcat manager on port 8080.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
418
419 ## The App Application
420
39b9174 @tekul Minor edit to README.md (review test)
tekul authored
421 This is a user interface app (primarily aimed at browsers) that uses
e578bc0 @dsyer CFID-36: tidy up and add some docs
dsyer authored
422 OpenId Connect for authentication (i.e. SSO) and OAuth2 for access
423 grants. It authenticates with the Auth service, and then accesses
00cf04c @dsyer Simplify integration test incantation
dsyer authored
424 resources in the API service. Run it with `mvn tomcat:run` from the
425 `app` directory (once all other tomcat processes have been shutdown).
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
426
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
427 The application can operate in multiple different profiles according
428 to the location (and presence) of the UAA server and the Login
429 application. By default it will look for a UAA on
430 `localhost:8080/uaa`, but you can change this by setting an
431 environment variable (or System property) called `UAA_PROFILE`. In
432 the application source code (`src/main/resources`) you will find
433 multiple properties files pre-configured with different likely
434 locations for those servers. They are all in the form
435 `application-<UAA_PROFILE>.properties` and the naming convention
436 adopted is that the `UAA_PROFILE` is `local` for the localhost
437 deployment, `vcap` for a `vcap.me` deployment, `staging` for a staging
438 deployment (inside VMware VPN), etc. The profile names are double
439 barrelled (e.g. `local-vcap` when the login server is in a different
440 location than the UAA server).
441
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
442 ### Use Cases
443
ab32020 @dsyer Update README
dsyer authored
444 1. See all apps
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
445
39b9174 @tekul Minor edit to README.md (review test)
tekul authored
446 GET /app/apps
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
447
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
448 browser is redirected through a series of authentication and
449 access grant steps (which could be slimmed down to implicit steps
450 not requiring user at some point), and then the photos are shown.
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
451
ab32020 @dsyer Update README
dsyer authored
452 2. See the currently logged in user details, a bag of attributes
650b10c @dsyer Initial draft - uaa with hard-coded user database
dsyer authored
453 grabbed from the open id provider
454
ab32020 @dsyer Update README
dsyer authored
455 GET /app
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
456
457 ## The Login Application
458
459 A user interface for authentication. The UAA can also authenticate
460 user accounts, but only if it manages them itself, and it only
461 provides a basic UI. The Login app can be branded and customized for
462 non-native authentication and for more complicate UI flows, like user
463 registration and password reset.
464
465 The login application is actually itself an OAuth2 endpoint provider,
466 but delegates those features to the UAA server. Configuration for the
467 login application therefore consists of locating the UAA through its
468 OAuth2 endpoint URLs, and registering the login application itself as
469 a client of the UAA. There is a `login.yml` for the UAA locations,
470 e.g. for a local `vcap` instance:
471
472 uaa:
473 url: http://uaa.vcap.me
474 token:
475 url: http://uaa.vcap.me/oauth/token
476 login:
477 url: http://uaa.vcap.me/login.do
478
479 and there is an environment variable (or Java System property),
480 `LOGIN_SECRET` for the client secret that the app uses when it
481 authenticates itself with the UAA. The Login app is registered by
482 default in the UAA only if there are no active Spring profiles (so not
3314a09 @tekul Fix some doc typos
tekul authored
483 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
484 `oauth-clients.xml` config file. Here's a summary:
485
c68ad47 @tekul CFID-374: Add password strength API to UAA API doc.
tekul authored
486 id: login
487 secret: loginsecret
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
488 authorized-grant-types: client_credentials
c68ad47 @tekul CFID-374: Add password strength API to UAA API doc.
tekul authored
489 authorities: ROLE_LOGIN
126fd01 @dsyer CFID-265: tidy client config and add docs
dsyer authored
490 resource-ids: oauth
491
492 ### Use Cases
493
494 1. Authenticate
495
496 GET /login
497
498 The sample app presents a form login interface for the backend
499 UAA, and also an OpenID widget so the user can authenticate using
500 Google etc. credentials.
501
502 2. Approve OAuth2 token grant
503
504 GET /oauth/authorize?client_id=app&response_type=code...
505
506 Standard OAuth2 Authorization Endpoint. Client credentials and
507 all other features are handled by the UAA in the back end, and the
508 login application is used to render the UI (see
509 `access_confirmation.jsp`).
510
511 3. Obtain access token
512
513 POST /oauth/token
514
515 Standard OAuth2 Authorization Endpoint passed through to the UAA.
6250f8a @dsyer Add contributor guidelines to README
dsyer authored
516
517 # Contributing to the UAA
518
519 Here are some ways for you to get involved in the community:
520
521 * Get involved with the Cloud Foundry community on the mailing lists.
522 Please help out on the
523 [mailing list](https://groups.google.com/a/cloudfoundry.org/forum/?fromgroups#!forum/vcap-dev)
524 by responding to questions and joining the debate.
525 * Create [github](https://github.com/cloudfoundry/uaa/issues) tickets for bugs and new features and comment and
526 vote on the ones that you are interested in.
527 * Github is for social coding: if you want to write code, we encourage
528 contributions through pull requests from
529 [forks of this repository](http://help.github.com/forking/). If you
530 want to contribute code this way, please reference an existing issue
531 if there is one as well covering the specific issue you are
532 addressing. Always submit pull requests to the "develop" branch.
533 * Watch for upcoming articles on Cloud Foundry by
534 [subscribing](http://blog.cloudfoundry.org) to the cloudfoundry.org
535 blog
Something went wrong with that request. Please try again.