SMART COSMOS Sample User Details Service

Devkit implementation of user details service for OAuth

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.smartcosmos
Идентификатор

Идентификатор

smartcosmos-user-details-devkit
Последняя версия

Последняя версия

3.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

SMART COSMOS Sample User Details Service
Devkit implementation of user details service for OAuth
Ссылка на сайт

Ссылка на сайт

http://smartcosmos.net/smartcosmos-user-details-devkit
Организация-разработчик

Организация-разработчик

Smartrac Technology Fletcher, Inc.
Система контроля версий

Система контроля версий

https://github.com/SMARTRACTECHNOLOGY/smartcosmos-user-details-devkit/tree/master/

Скачать smartcosmos-user-details-devkit

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.smartcosmos/smartcosmos-user-details-devkit/ -->
<dependency>
    <groupId>net.smartcosmos</groupId>
    <artifactId>smartcosmos-user-details-devkit</artifactId>
    <version>3.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.smartcosmos/smartcosmos-user-details-devkit/
implementation 'net.smartcosmos:smartcosmos-user-details-devkit:3.0.0'
// https://jarcasting.com/artifacts/net.smartcosmos/smartcosmos-user-details-devkit/
implementation ("net.smartcosmos:smartcosmos-user-details-devkit:3.0.0")
'net.smartcosmos:smartcosmos-user-details-devkit:jar:3.0.0'
<dependency org="net.smartcosmos" name="smartcosmos-user-details-devkit" rev="3.0.0">
  <artifact name="smartcosmos-user-details-devkit" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.smartcosmos', module='smartcosmos-user-details-devkit', version='3.0.0')
)
libraryDependencies += "net.smartcosmos" % "smartcosmos-user-details-devkit" % "3.0.0"
[net.smartcosmos/smartcosmos-user-details-devkit "3.0.0"]

Зависимости

compile (4)

Идентификатор библиотеки Тип Версия
org.apache.commons : commons-collections4 jar 4.1
org.mariadb.jdbc : mariadb-java-client jar 1.4.3
net.smartcosmos : smartcosmos-framework jar 3.0.0
net.smartcosmos : smartcosmos-user-entity-devkit jar 3.0.0

provided (1)

Идентификатор библиотеки Тип Версия
org.projectlombok : lombok jar 1.16.6

test (10)

Идентификатор библиотеки Тип Версия
com.h2database : h2 jar
org.hamcrest : hamcrest-core jar
org.hamcrest : hamcrest-library jar
org.json : json jar
com.jayway.jsonpath : json-path jar
com.jayway.jsonpath : json-path-assert jar
org.mapstruct : mapstruct jar 1.0.0.Final
net.smartcosmos : smartcosmos-framework-test jar 3.0.0
org.springframework.boot : spring-boot-starter-test jar
com.jayway.restassured : spring-mock-mvc jar

Модули Проекта

Данный проект не имеет модулей.

SMART COSMOS DevKit User Details Service

Build Status

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.

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/alice@example.com
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" : "alice@example.com",
   "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}
net.smartcosmos

Smart Cosmos Solutions Inc.

Версии библиотеки

Версия
3.0.0