simter-jwt

Pure Java implementation for JSON Web Token (JWT)

Лицензия

Лицензия

MIT
Группа

Группа

tech.simter
Идентификатор

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

simter-jwt
Последняя версия

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

1.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

simter-jwt
Pure Java implementation for JSON Web Token (JWT)
Ссылка на сайт

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

https://github.com/simter/simter-jwt
Организация-разработчик

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

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

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

https://github.com/simter/simter-jwt.git

Скачать simter-jwt

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

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
javax.json : javax.json-api jar 1.1.4

test (2)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter jar
com.owlike : genson jar 1.5

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

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

simter-jwt [中文]

Pure Java implementation for JSON Web Token (JWT) [RFC7519]

Installation

<dependency>
  <groupId>tech.simter</groupId>
  <artifactId>simter-jwt</artifactId>
  <version>1.0.0</version>
</dependency>

Requirement

  • Java 8+ - this component use java8 native Base64 and HMACSHA-256
  • At lease one JSR-353 provider (Java API for JSON Processing)
    e.g. Genson, Jackson, Glassfish

Usage

Create a JWT

// create a default header: 
// e.g. {"typ":"JWT","alg":"HS256"}
Header header = Header.DEFAULT;

// create a payload
// e.g. {"iss":"RJ","aud":"you","exp":1483200000,"iat":1451577600,"name":"tester"}
Payload payload = new Payload();

// set some registed claims
payload.issuer = "RJ";
payload.audience = "you";
payload.issuedAt = ZonedDateTime.now().toEpochSecond();
payload.expires = ZonedDateTime.now().plusMonths(1).toEpochSecond();

// add your public/private claims
payload.add("name", "tester");
...

// sign and encode with the secret key
// eg. [header].[payload].[signature]
String jwt = new JWT(header, payload).generate("the-secret-key");

Verify a JWT

// verify and decode to a JWT instance
JWT jwt = JWT.verify("[header].[payload].[signature]", "the-secret-key");

// get your public/private claims value
String name = jwt.payload.get("name");

Build

mvn clean package

Deploy

First take a look at simter-parent deploy config.

Deploy to LAN Nexus Repository

mvn clean deploy -Plan

Deploy to Sonatype Repository

mvn clean deploy -Psonatype

After deployed, login into https://oss.sonatype.org. Through Staging Repositories, search this package, then close and release it. After couple hours, it will be synced to Maven Central Repository.

Deploy to Bintray Repository

mvn clean deploy -Pbintray

Will deploy to https://api.bintray.com/maven/simter/maven/tech.simter:simter-jwt/;publish=1. So first create a package https://bintray.com/simter/maven/tech.simter:simter-jwt on Bintray. After deployed, check it from https://jcenter.bintray.com/tech/simter/simter-jwt.

References

tech.simter

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

Версия
1.1.0
1.0.0
0.4.0
0.3.0
0.1.0