cn.har01d:auth-core

Token service for authentication, support Redis, database, memory and JWT Token.

License

License

GroupId

GroupId

cn.har01d
ArtifactId

ArtifactId

auth-core
Last Version

Last Version

0.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

Token service for authentication, support Redis, database, memory and JWT Token.
Project Organization

Project Organization

Har01d

Download auth-core

How to add to project

<!-- https://jarcasting.com/artifacts/cn.har01d/auth-core/ -->
<dependency>
    <groupId>cn.har01d</groupId>
    <artifactId>auth-core</artifactId>
    <version>0.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/cn.har01d/auth-core/
implementation 'cn.har01d:auth-core:0.0.4'
// https://jarcasting.com/artifacts/cn.har01d/auth-core/
implementation ("cn.har01d:auth-core:0.0.4")
'cn.har01d:auth-core:jar:0.0.4'
<dependency org="cn.har01d" name="auth-core" rev="0.0.4">
  <artifact name="auth-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='cn.har01d', module='auth-core', version='0.0.4')
)
libraryDependencies += "cn.har01d" % "auth-core" % "0.0.4"
[cn.har01d/auth-core "0.0.4"]

Dependencies

compile (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-web jar 2.3.3.RELEASE
org.springframework.boot : spring-boot-starter-security jar 2.3.3.RELEASE
org.springframework.boot : spring-boot-configuration-processor Optional jar 2.3.3.RELEASE
org.jetbrains.kotlin : kotlin-reflect jar
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar

Project Modules

There are no modules declared in this project.

auth

Token service for authentication, support Redis, database, memory and JWT Token.

Designed for Spring Boot projects.

Maven

<dependency>
    <groupId>cn.har01d</groupId>
    <artifactId>auth</artifactId>
    <version>0.0.1</version>
</dependency>

Support Types

Redis

@EnableRedisToken

Database

@EnableDatabaseToken

Memory

Default

JWT

@EnableJwtToken

Endpoints

Login

POST /accounts/login
{
	"username": "user",
	"password": "bf3916a0-a7e0-4177-9b74-fa5b0b7e438f",
	"rememberMe": false
}

Logout

POST /accounts/logout
X-ACCESS-TOKEN: {{TOKEN}}

Get Principal

GET /accounts/principal
X-ACCESS-TOKEN: {{TOKEN}}

Token Usage

Add token in Header or Parameter X-ACCESS-TOKEN.

Configuration

cn:
  har01d:
    auth:
      idle-timeout: 30
      header-name: "X-ACCESS-TOKEN"
      table-name: "t_token"
      redis-prefix: "TOKEN:a:"
      jwt:
        secretKey: ""
        issuer: "Har01d"
        subject: "auth0"
        audience: "web"

Example

package cn.har01d.example

import cn.har01d.auth.annotation.EnableJwtToken
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
@EnableJwtToken
class ExampleApplication

fun main(args: Array<String>) {
    runApplication<ExampleApplication>(*args)
}

Versions

Version
0.0.4
0.0.3