AuthenticationResource Resource

Authentication related RESTful Web Service endpoint.

GET /api/rest/authentication

Returns the current state of the application.

Response Codes
code condition
200 success
401 unauthorized, user is not authenticated and public access is disabled
500 internal server error
Response Body
media type data type
application/json ScmState (JSON)
application/xml scmState (XML)

Example

Request
GET /authentication
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "assignedPermissions" : [ "...", "..." ],
  "availablePermissions" : [ {
    "description" : "...",
    "display-name" : "...",
    "value" : "..."
  }, {
    "description" : "...",
    "display-name" : "...",
    "value" : "..."
  } ],
  "clientConfig" : {
    "disableGroupingGrid" : true,
    "dateFormat" : "...",
    "enableRepositoryArchive" : true
  },
  "defaultUserType" : "...",
  "groups" : [ "...", "..." ],
  "repositoryTypes" : [ {
    "displayName" : "...",
    "name" : "..."
  }, {
    "displayName" : "...",
    "name" : "..."
  } ],
  "success" : true,
  "user" : {
    "active" : true,
    "admin" : true,
    "creationDate" : 12345,
    "displayName" : "...",
    "lastModified" : 12345,
    "mail" : "...",
    "name" : "...",
    "password" : "...",
    "type" : "...",
    "properties" : [ {
      "key" : "...",
      "value" : "..."
    }, {
      "key" : "...",
      "value" : "..."
    } ]
  },
  "version" : "..."
}
                
              

POST /api/rest/authentication/login

Authenticate a user and return the state of the application.

Request Parameters
name type description default constraints
password form the password for the authentication    
rememberMe form true to remember the user across sessions false boolean
username form the username for the authentication    
Response Codes
code condition
200 success
400 bad request, required parameter is missing
401 unauthorized, the specified username or password is wrong
500 internal server error
Response Body
media type data type
application/json ScmState (JSON)
application/xml scmState (XML)

Example

Request
POST /authentication/login
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "assignedPermissions" : [ "...", "..." ],
  "availablePermissions" : [ {
    "description" : "...",
    "display-name" : "...",
    "value" : "..."
  }, {
    "description" : "...",
    "display-name" : "...",
    "value" : "..."
  } ],
  "clientConfig" : {
    "disableGroupingGrid" : true,
    "dateFormat" : "...",
    "enableRepositoryArchive" : true
  },
  "defaultUserType" : "...",
  "groups" : [ "...", "..." ],
  "repositoryTypes" : [ {
    "displayName" : "...",
    "name" : "..."
  }, {
    "displayName" : "...",
    "name" : "..."
  } ],
  "success" : true,
  "user" : {
    "active" : true,
    "admin" : true,
    "creationDate" : 12345,
    "displayName" : "...",
    "lastModified" : 12345,
    "mail" : "...",
    "name" : "...",
    "password" : "...",
    "type" : "...",
    "properties" : [ {
      "key" : "...",
      "value" : "..."
    }, {
      "key" : "...",
      "value" : "..."
    } ]
  },
  "version" : "..."
}
                
              

GET /api/rest/authentication/logout

Logout the current user. Returns the current state of the application, if public access is enabled.

Response Codes
code condition
200 success
500 internal server error
Response Body
media type data type
application/json ScmState (JSON)
application/xml scmState (XML)

Example

Request
GET /authentication/logout
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "assignedPermissions" : [ "...", "..." ],
  "availablePermissions" : [ {
    "description" : "...",
    "display-name" : "...",
    "value" : "..."
  }, {
    "description" : "...",
    "display-name" : "...",
    "value" : "..."
  } ],
  "clientConfig" : {
    "disableGroupingGrid" : true,
    "dateFormat" : "...",
    "enableRepositoryArchive" : true
  },
  "defaultUserType" : "...",
  "groups" : [ "...", "..." ],
  "repositoryTypes" : [ {
    "displayName" : "...",
    "name" : "..."
  }, {
    "displayName" : "...",
    "name" : "..."
  } ],
  "success" : true,
  "user" : {
    "active" : true,
    "admin" : true,
    "creationDate" : 12345,
    "displayName" : "...",
    "lastModified" : 12345,
    "mail" : "...",
    "name" : "...",
    "password" : "...",
    "type" : "...",
    "properties" : [ {
      "key" : "...",
      "value" : "..."
    }, {
      "key" : "...",
      "value" : "..."
    } ]
  },
  "version" : "..."
}
                
              

GET /api/rest/authentication/state

This method is an alias of the #getState(HttpServletRequest) method. The only difference between the methods, is that this one could not be used with basic authentication.

Response Codes
code condition
200 success
401 unauthorized, user is not authenticated and public access is disabled
500 internal server error
Response Body
media type data type
application/json ScmState (JSON)
application/xml scmState (XML)

Example

Request
GET /authentication/state
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "assignedPermissions" : [ "...", "..." ],
  "availablePermissions" : [ {
    "description" : "...",
    "display-name" : "...",
    "value" : "..."
  }, {
    "description" : "...",
    "display-name" : "...",
    "value" : "..."
  } ],
  "clientConfig" : {
    "disableGroupingGrid" : true,
    "dateFormat" : "...",
    "enableRepositoryArchive" : true
  },
  "defaultUserType" : "...",
  "groups" : [ "...", "..." ],
  "repositoryTypes" : [ {
    "displayName" : "...",
    "name" : "..."
  }, {
    "displayName" : "...",
    "name" : "..."
  } ],
  "success" : true,
  "user" : {
    "active" : true,
    "admin" : true,
    "creationDate" : 12345,
    "displayName" : "...",
    "lastModified" : 12345,
    "mail" : "...",
    "name" : "...",
    "password" : "...",
    "type" : "...",
    "properties" : [ {
      "key" : "...",
      "value" : "..."
    }, {
      "key" : "...",
      "value" : "..."
    } ]
  },
  "version" : "..."
}