Skip to content

Authentication Service

Wuyi Chen edited this page Jun 29, 2019 · 13 revisions

Description

Issue and validate access tokens and manage clients and users.

Technique

  • Spring Cloud Security
  • OAuth2
  • Spring Data JPA
  • Netflix Eureka
  • Netflix Hystrix

Services/Servers protected by Autentication service:

  • Organization Service

Available API Calls

AS1: Get an access token (by the client credential and the user credential).

KEY VALUE
grant_type password
scope webclient
username john.carnell
password password1
  • Notes

AS2: Retrieve the user information.

KEY VALUE
Authorization Bearer {access_token}
  • Body
  • Notes

AS3: Get a client record by client ID.

KEY VALUE
Authorization Bearer {access_token}
  • Body
  • Notes

AS4: Update a client record.

KEY VALUE
Authorization Bearer {access_token}
Content-Type application/json
  • Body
{
    "clientId": "eagleeye",
    "resourceIds": null,
    "clientSecret": "123456cs",
    "scope": "webclient,mobileclient",
    "authorizedGrantTypes": "refresh_token,password,client_credentials",
    "webServerRedirectUri": null,
    "authorities": null,
    "accessTokenValidity": 36000,
    "refreshTokenValidity": 36000,
    "additionalInformation": null,
    "autoapprove": "1"
}
  • Notes

AS5: Add a new client record.

KEY VALUE
Authorization Bearer {access_token}
Content-Type application/json
  • Body
{
    "clientId": "eagleeye",
    "resourceIds": null,
    "clientSecret": "123456cs",
    "scope": "webclient,mobileclient",
    "authorizedGrantTypes": "refresh_token,password,client_credentials",
    "webServerRedirectUri": null,
    "authorities": null,
    "accessTokenValidity": 36000,
    "refreshTokenValidity": 36000,
    "additionalInformation": null,
    "autoapprove": "1"
}
  • Notes

AS6: Delete a client record by client ID.

KEY VALUE
Authorization Bearer {access_token}
  • Body
  • Notes

AS7: Get a user record with authorities by username.

KEY VALUE
Authorization Bearer {access_token}
  • Body
  • Notes

AS8: Update a new user record with authorities.

KEY VALUE
Authorization Bearer {access_token}
Content-Type application/json
  • Body
{
    "username": "mary.dawson",
    "password": "password3",
    "enabled": true,
    "authoritiesList": [
        {
            "username": "mary.dawson",
            "authority": "USER"
        }
    ]
}
  • Notes

AS9: Add a new user record with authorities.

KEY VALUE
Authorization Bearer {access_token}
Content-Type application/json
  • Body
{
    "username": "mary.dawson",
    "password": "password3",
    "enabled": true,
    "authoritiesList": [
        {
            "username": "mary.dawson",
            "authority": "USER"
        }
    ]
}
  • Notes

AS10: Delete a user record with authorities by username.

KEY VALUE
Authorization Bearer {access_token}
  • Body
  • Notes

Database Table(s)

  • oauth_client_details
  • users
  • authorities
  • user_orgs
Clone this wiki locally