Aus Free Software
Version vom 3. August 2010, 00:30 Uhr von Mati (Diskussion | Beiträge) (first version)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen



Essentially, when dealing with shared authentication, you have to deal with two types of accounts:

  1. Users that want to authenticate themselves against some service
  2. The service that wants to use the shared authentication

In the following documentation, we refer to (1) as ServiceUser and (2) to Service.

Create a ServiceUser

In order to create a ServiceUser, perform an HTTP request to:

POST /users/

The POST data MUST contain two values:

The name of the user to create
The password for this user

This method returns the following status codes:

201 Created 
If the creation of the user succeeded
400 Bad Request 
If either the POST data did not contain a username and password or if either username or password is not acceptable to the system.
405 Method Not Allowed 
If the request to /users/ was not a POST request
409 Conflict 
If the user already exists
500 Internal Server Error 
If any other problem occurs

To create a user with curl, do:

curl -X POST -w "%{http_code}\n" -d "username=myuser&password=mypassword" http://user:pass@localhost:8000/users/

Update a ServiceUser

To update the credentials of a ServiceUser, perform an HTTP request to:

PUT /users/<username>

where "<username>" is the name of the user to update.

The request data is interpreted the same way as with a POST request. It must contain either username and/or password. The service may not allow to update the username itself (see status codes below).

This method returns the following status codes:

200 OK 
If the credentials where successfully updated
400 Bad Request 
If the request data could not be parsed or if the new username/password is not acceptable to the system.
403 Forbidden 
If the Service attempts to change the username and the RestAuth instance does not allow such a change.
404 Not Found 
If the username does not exist