Skip to content

Commit 1408e96

Browse files
authored
Merge pull request #383 from kbase/develop
Develop -> Master (Release 0.6.0)
2 parents ee6061e + 595d365 commit 1408e96

133 files changed

Lines changed: 3750 additions & 1402 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 72 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
KBase authentication server
2-
===========================
1+
# KBase authentication server
32

43
This repo contains the second iteration of the KBase authentication server.
54

65
Build status (master):
76
[![Build Status](https://travis-ci.org/kbase/auth2.svg?branch=master)](https://travis-ci.org/kbase/auth2) [![codecov](https://codecov.io/gh/kbase/auth2/branch/master/graph/badge.svg)](https://codecov.io/gh/kbase/auth2)
87

98

10-
Current endpoints
11-
-----------------
9+
## Current endpoints
1210

1311
### UI
1412

@@ -20,53 +18,53 @@ testing. In many cases a manual refresh of the page will be required to see
2018
changes. Further, once a checkbox is manually checked or unchecked that state
2119
will not change, even with a refresh - to see changes reset the form.
2220

23-
/
21+
`/`
2422
General server information including git commit, version, and server time.
2523

26-
/admin
24+
`/admin`
2725
Global admin tasks - force reset all passwords, revoke all tokens, view a token, search for users.
2826

29-
/admin/customroles
27+
`/admin/customroles`
3028
View, add, and delete custom roles.
3129

32-
/admin/config
30+
`/admin/config`
3331
View and edit the server configuration.
3432

35-
/admin/localaccount
33+
`/admin/localaccount`
3634
Create a local account.
3735

38-
/admin/user/<user name>
36+
`/admin/user/<user name>`
3937
View user, disable user, reset password, force password reset, and modify user roles.
4038

41-
/admin/user/&lt;user name&gt;/tokens
39+
`/admin/user/<user name>/tokens`
4240
View and revoke tokens for a specific user.
4341

44-
/customroles
42+
`/customroles`
4543
View custom roles. This page is publicly viewable to any user with a valid token.
4644

47-
/link
45+
`/link`
4846
Link accounts.
4947

50-
/login
48+
`/login`
5149
Login to a provider based account. Stores a cookie with a token.
5250

53-
/localaccount/login
51+
`/localaccount/login`
5452
Login to a local account. Stores a cookie with a token.
5553

56-
/localaccount/reset
54+
`/localaccount/reset`
5755
Reset the password for a local account.
5856

59-
/logout
57+
`/logout`
6058
Logs the user out.
6159
Removes the user's token from the database as well as any temporary link tokens associated with
6260
the user. Removes the login, temporary login, and temporary link cookies except if JSON output
6361
is requested, in which case it is expected that the UI manages the login token
6462
(but not the temporary tokens).
6563

66-
/me
64+
`/me`
6765
User page. Update name and email address, remove roles.
6866

69-
/tokens
67+
`/tokens`
7068
List, create, and revoke tokens.
7169

7270
### API
@@ -81,41 +79,56 @@ noted.
8179
Tokens are opaque strings - no particular structure should be assumed, and token string contents
8280
may change without notice.
8381

84-
GET /api/V2/me
82+
`GET /api/V2/me`
8583
See the current user's profile.
8684

87-
PUT /api/V2/me
85+
`PUT /api/V2/me`
8886
Update the current user's email address and display name. Takes JSON encoded data with the
8987
keys `display` and `email`.
9088

91-
GET /api/V2/users/?list=&lt;comma separated user names&gt;
89+
`GET /api/V2/users/?list=<comma separated user names>`
9290
Validate a set of user names and get the users' display names. Returns a map of username ->
9391
display name. Any usernames that do not correspond to accounts will not be included in the map.
9492

95-
GET /api/V2/users/search/&lt;prefix&gt;/?fields=&lt;comma separated fields&gt;
93+
`GET /api/V2/users/search/<prefix>/?fields=<comma separated fields>`
9694
Find users based on a prefix of the username or any parts of the display name, where parts are
9795
delimited by whitespace. By default the search occurs on all fields; setting the fields query
9896
parameter can restrict the search fields and thus possibly speed up the search. Current field names
9997
are `username` and `displayname`; any other field names are ignored. Returns a map of
10098
username -> display name. At most 10,000 names are returned.
10199

102-
GET /api/V2/token
100+
`GET /api/V2/token`
103101
Introspect a token.
104102

105-
POST /api/V2/token
103+
`POST /api/V2/token`
106104
Create an agent token. Takes JSON encoded data with the keys `name` for a required token name
107105
string and `customcontext` for an optional map of user-supplied creation context to be saved
108106
with the token, and returned when the token is queried.
109107

108+
`GET /api/v2/admin/anonids?list=<comma separated anonymous user IDs>`
109+
Translate anonymous user IDs to user names. `Admin` (and exactly `Admin`) permission
110+
is required. At most 10000 IDs are allowed, but the URL size limit effectively limits the count
111+
to less than that. Disabled users are not returned; IDs not found in the database are omitted from
112+
the map.
113+
114+
RETURNS:
115+
```
116+
{
117+
<anonymous ID 1>: <user name 1>,
118+
...
119+
<anonymous ID N>: <user name N>
120+
}
121+
```
122+
110123
#### Legacy
111124

112125
Endpoints (mostly) identical to the original Globus and KBase auth endpoints are provided for
113126
backwards compatibility.
114127

115-
POST /api/legacy/KBase/Sessions/Login
128+
`POST /api/legacy/KBase/Sessions/Login`
116129
The legacy KBase API.
117130

118-
GET /api/legacy/globus
131+
`GET /api/legacy/globus`
119132
The legacy globus API. Endpoints are /goauth/token and /users.
120133

121134
### Test Mode
@@ -143,55 +156,55 @@ Test mode data is only accessible via endpoints under the `/testmode` root endpo
143156
These endpoints mimic the behavior of the standard API endpoints above, but only interact with
144157
test mode data.
145158

146-
GET /testmode
159+
`GET /testmode`
147160

148-
GET /testmode/api/V2/me
161+
`GET /testmode/api/V2/me`
149162

150-
GET /testmode/api/V2/token
163+
`GET /testmode/api/V2/token`
151164

152-
GET /testmode/api/V2/users
165+
`GET /testmode/api/V2/users`
153166

154-
POST /testmode/api/legacy/KBase/Sessions/Login
167+
`POST /testmode/api/legacy/KBase/Sessions/Login`
155168

156-
GET /testmode/api/legacy/globus
169+
`GET /testmode/api/legacy/globus`
157170

158171
#### Data manipulation endpoints
159172

160173
These endpoints allow a test harness to create and modify test mode users, tokens, and roles.
161174
No authentication is required.
162175

163-
POST /testmode/api/V2/testmodeonly/user
176+
`POST /testmode/api/V2/testmodeonly/user`
164177
Create a user. Takes JSON encoded data with the keys `user` for the user name and `display` for
165178
the user's display name.
166179

167-
GET /testmode/api/V2/testmodeonly/user/&lt;username&gt;
180+
`GET /testmode/api/V2/testmodeonly/user/<username>`
168181
Get a user's data.
169182

170-
POST /testmode/api/V2/testmodeonly/token
183+
`POST /testmode/api/V2/testmodeonly/token`
171184
Create a token. The user to which the token is assigned must exist. Takes JSON encoded data with
172185
the keys `user` for the user name, `name` for an optional token name, and `type` for the token
173186
type. `type` is one of `Login`, `Agent`, `Dev`, or `Serv`.
174187

175-
POST /testmode/api/V2/testmodeonly/customroles
188+
`POST /testmode/api/V2/testmodeonly/customroles`
176189
Create a custom role. Takes JSON encoded data with the keys `id` for the role id and `desc` for
177190
the role description. Posting a role with an existing ID overwrites the description of the role.
178191

179-
GET /testmode/api/V2/testmodeonly/customroles
192+
`GET /testmode/api/V2/testmodeonly/customroles`
180193
Get the list of extant custom roles.
181194

182-
PUT /testmode/api/V2/testmodeonly/userroles
195+
`PUT /testmode/api/V2/testmodeonly/userroles`
183196
Set a user's roles, overwriting any current roles. Takes JSON encoded data with the keys `user`
184197
for the user name of the user to modify, `roles` for a list of built-in roles to grant to the
185198
user, and `customroles` for a list of custom role ids to grant to the user. Allowed `roles` are
186199
`DevToken`, `ServToken`, `Admin`, and `CreateAdmin`. Note that these roles don't grant
187200
any actual privileges in test mode. Omitting `roles` and `customroles` removes all roles from
188201
the user.
189202

190-
DELETE /testmode/api/V2/testmodeonly/clear
203+
`DELETE /testmode/api/V2/testmodeonly/clear`
191204
Removes all test mode data from the system.
192205

193-
Admin notes
194-
-----------
206+
## Admin notes
207+
195208
* It is expected that this server always runs behind a reverse proxy (such as
196209
nginx) that enforces https / TLS and as such the auth server is configured to
197210
allow cookies to be set over insecure connections.
@@ -211,9 +224,16 @@ Admin notes
211224
* Get Google OAuth2 creds [here](https://console.developers.google.com/apis)
212225
* Get OrcID creds [here](https://orcid.org/content/register-client-application-0)
213226
* Note that only the public API has been tested with the auth server.
227+
* In version 0.6.0, the canonicalization algorithm for user display names changed and the
228+
database needs to be updated.
229+
* See the `--recanonicalize-display-names` option for the `manage_auth` script. This can
230+
be run while the server is live **after** updating to version 0.6.0.
231+
* Once the names have been recanonicalized, the `--remove-recanonicalization-flag` can be
232+
used to remove flags set on database objects to avoid reprocessing if the recanonicalize
233+
process does not complete.
234+
235+
## Requirements
214236

215-
Requirements
216-
------------
217237
Java 8 (OpenJDK OK)
218238
Apache Ant (http://ant.apache.org/)
219239
MongoDB 2.6+ (https://www.mongodb.com/)
@@ -223,8 +243,8 @@ This repo (git clone https://github.com/kbase/auth2)
223243
The jars repo (git clone https://github.com/kbase/jars)
224244
The two repos above need to be in the same parent folder.
225245

226-
To start server
227-
---------------
246+
## To start server
247+
228248
start mongodb
229249
if using mongo auth, create a mongo user
230250
cd into the auth2 repo
@@ -234,8 +254,8 @@ copy `deploy.cfg.example` to `deploy.cfg` and fill in appropriately
234254
`cd jettybase`
235255
`./jettybase$ java -jar -Djetty.port=<port> <path to jetty install>/start.jar`
236256

237-
Administer the server
238-
---------------------
257+
## Administer the server
258+
239259
Set a root password:
240260
`./manage_auth -d <path to deploy.cfg> -r`
241261

@@ -244,15 +264,14 @@ local account and assign it the create administrator role. That account can
244264
then be used to create further administrators (including itself) without
245265
needing to login as root. The root account can then be disabled.
246266

247-
Start & stop server w/o a pid
248-
-----------------------------
267+
## Start & stop server w/o a pid
268+
249269
`./jettybase$ java -DSTOP.PORT=8079 -DSTOP.KEY=foo -jar ~/jetty/jetty-distribution-9.3.11.v20160721/start.jar`
250270
`./jettybase$ java -DSTOP.PORT=8079 -DSTOP.KEY=foo -jar ~/jetty/jetty-distribution-9.3.11.v20160721/start.jar --stop`
251271

252272
Omit the stop key to have jetty generate one for you.
253273

254-
Developer notes
255-
---------------
274+
## Developer notes
256275

257276
### Adding and releasing code
258277

@@ -306,7 +325,6 @@ In `us.kbase.auth2.lib.exceptions`:
306325

307326
Anything else is mapped to 500.
308327

309-
Ancient history
310-
---------------
328+
## Ancient history
311329

312330
https://github.com/kbaseIncubator/auth2proto

0 commit comments

Comments
 (0)