Skip to content

Commit 36a225b

Browse files
committed
Add JWT documentation
1 parent d18078c commit 36a225b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,46 @@ By default `UUIDAccessTokenConverter` is used. With a default time-out of 1 hour
132132
```kotlin
133133
accessTokenConverter = UUIDAccessTokenConverter(1800)
134134
```
135+
136+
To use JWT include the following dependency:
137+
```xml
138+
<dependency>
139+
<groupId>nl.myndocs</groupId>
140+
<artifactId>oauth2-server-jwt</artifactId>
141+
<version>${myndocs.oauth.version}</version>
142+
</dependency>
143+
```
144+
This uses [auth0 jwt](https://github.com/auth0/java-jwt). To configure:
145+
```kotlin
146+
accessTokenConverter = JwtAccessTokenConverter(
147+
algorithm = Algorithm.HMAC256("test123"), // mandatory
148+
accessTokenExpireInSeconds = 1800, // optional default 3600
149+
jwtBuilder = DefaultJwtBuilder // optional uses DefaultJwtBuilder by default
150+
)
151+
```
152+
135153
#### Refresh token converter
136154
By default `UUIDRefreshTokenConverter` is used. With a default time-out of 1 hour. To override the time-out for example to half an hour:
137155
```kotlin
138156
refreshTokenConverter = UUIDRefreshTokenConverter(1800)
139157
```
158+
159+
To use JWT include the following dependency:
160+
```xml
161+
<dependency>
162+
<groupId>nl.myndocs</groupId>
163+
<artifactId>oauth2-server-jwt</artifactId>
164+
<version>${myndocs.oauth.version}</version>
165+
</dependency>
166+
```
167+
This uses [auth0 jwt](https://github.com/auth0/java-jwt). To configure:
168+
```kotlin
169+
refreshTokenConverter = JwtRefreshTokenConverter(
170+
algorithm = Algorithm.HMAC256("test123"), // mandatory
171+
refreshTokenExpireInSeconds = 1800, // optional default 86400
172+
jwtBuilder = DefaultJwtBuilder // optional uses DefaultJwtBuilder by default
173+
)
174+
```
140175
#### Code token converter
141176
By default `UUIDCodeTokenConverter` is used. With a default time-out of 5 minutes. To override the time-out for example 2 minutes:
142177
```kotlin

0 commit comments

Comments
 (0)