Skip to content

Authentication

coleslaw481 edited this page Oct 13, 2014 · 10 revisions

Authentication

CRBS Workflow Service REST API authenticates each request by validating a user login and user token passed with each request. These values can be passed via Basic HTTP Authentication or by Query Parameters. Both approaches are described below.

NOTE: The preferred method is Basic HTTP Authentication.

Basic HTTP Authentication

In this mode the user login is extracted from the user part of the Basic HTTP Authentication string and the user token is extracted from the password part. This mode is checked first and if found no attempt is made at Query Parameter Authentication

# Example Basic HTTP Authentication via curl where userlogin is somebody and token is 23498fj4fjsd
# to retreive all jobs
curl -u somebody:23498fj4fjsd -X GET https://crbsworkflow.appspot.com/rest/jobs

Query Parameter Authentication

In this mode the user login and user token are set via query parameters appended to the URL. If Query Parameter Authentication is used then the following two parameters must be set:

  • userlogin -- Your login
  • usertoken -- A unique token string
# Example call to all jobs using query parameter authentication
curl -X GET https://crbsworkflow.appspot.com/rest/jobs?userlogin=somebody&usertoken=23498fj4fjsd

Running on behalf of another user

Every REST call can also optionally take the following query parameter which lets the caller perform an operation on behalf of another user.

  • runasuser -- login of user to perform the operation as. The authentication still relies on values of userlogin and usertoken. This is useful for web gateways running jobs for other users.
# Example using runasuser query parameter to get all jobs
curl -u somebody:23498fj4fjsd -X GET https://crbsworkflow.appspot.com/rest/jobs?runasuser=phil

NOTE: If runasuser is added as a query param, but the user is not authorized to perform tasks as that user, all service calls will fail