mirror of https://github.com/jwtk/jjwt.git
parent
47ec679046
commit
27ec90f35a
10
README.md
10
README.md
|
@ -36,14 +36,14 @@ Most complexity is hidden behind a convenient and readable builder-based [fluent
|
||||||
|
|
||||||
```java
|
```java
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import static io.jsonwebtoken.SignatureAlgorithm.*;
|
import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
|
|
||||||
//Let's create a random signing key for testing:
|
// We need a signing key, so we'll create one just for this example. Usually
|
||||||
Random random = new SecureRandom();
|
// the key would be read from your application configuration instead.
|
||||||
byte[] key = new byte[64];
|
byte[] key = new byte[64];
|
||||||
random.nextBytes(key);
|
new SecureRandom().nextBytes(key);
|
||||||
|
|
||||||
String compact = Jwts.builder().setSubject("Joe").signWith(HS256, key).compact();
|
String compact = Jwts.builder().setSubject("Joe").signWith(SignatureAlgorithm.HS256, key).compact();
|
||||||
```
|
```
|
||||||
|
|
||||||
How easy was that!?
|
How easy was that!?
|
||||||
|
|
Loading…
Reference in New Issue