SMART COSMOS DevKit User Details Service
Microservice which provides user authorties for OAuth token generation.
It uses the same database as the edge-user-devkit service for user, tenant, role and authority management, see user-entity-devkit.
Copyright and License
Code and documentation copyright 2016 Smartrac Technology Fletcher, Inc. Code released under Apache 2.0 License.
REST API
Available methods
Authenticate - POST /authenticate
POST /authenticate
{
"details": {
"grant_type": "password",
"scope": "read",
"username": "bob"
},
"authorities": [],
"authenticated": false,
"principal": "bob",
"credentials": "xyz1234567",
"name": "bob"
}
Response
200 OK
{
"userUrn": "urn:user:uuid:68a76616-3748-4bc2-93c1-3940b47abb7f",
"username": "bob",
"passwordHash": "",
"authorities": [
"https://authorities.smartcosmos.net/things/read",
"https://authorities.smartcosmos.net/things/create"
],
"tenantUrn": "urn:tenant:uuid:69bb7c6a-a43b-493d-8e9d-e5a3ed65728a"
}
400 Bad Request
{
"code": 1,
"message": "Invalid username or password"
}
Active (used for Token Refresh) - GET /active/{username}
This endpoint requires HTTP Basic Authentication.
GET /active/[email protected]
Response
200 OK
{
"authorities" : [
"https://authorities.smartcosmos.net/things/read"
],
"tenantUrn" : "urn:account:uuid:53f452c2-5a01-44fd-9956-3ecff7c32b30",
"userUrn" : "urn:user:uuid:53f452c2-5a01-44fd-9956-3ecff7c32b30",
"name" : "[email protected]",
"passwordHash" : ""
}
400 Bad Request
{
"code" : 1,
"message" : "Invalid username or password"
}
401 Unauthorized
Configuration
The user details service needs to be properly configured for the following purposes:
-
accessing the user database
-
getting called by the auth server for authority provision
server:
port: 5555
spring:
datasource:
url: jdbc:mysql://localhost/{dbName}?autoReconnect=true
username: {dbUser}
password: {dbPassword}
driver-class-name: org.mariadb.jdbc.Driver
jpa:
hibernate:
# Edge User DevKit and User Details DevKit share the database scheme, but the details service just reads
ddl-auto: verify
naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
smartcosmos:
security:
enabled: true
resource:
user-details:
name: {authClientName}
password: {authClientPassword}