Skip to content

Commit

Permalink
Copy changes from quarkusio#1490 to the JWT guide
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfedh committed Jan 30, 2025
1 parent 86d592a commit 6395740
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions docs/src/main/asciidoc/security-jwt.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -359,21 +359,25 @@ import java.util.Arrays;
import java.util.HashSet;
import org.eclipse.microprofile.jwt.Claims;
import io.smallrye.jwt.build.Jwt;
/**
* A utility class to generate and print a JWT token string to stdout.
*/
public class GenerateToken {
/**
* Generate JWT token
* Generates and prints a JWT token.
*/
public static void main(String[] args) {
String token =
Jwt.issuer("https://example.com/issuer") // <1>
.upn("[email protected]") // <2>
.groups(new HashSet<>(Arrays.asList("User", "Admin"))) // <3>
.claim(Claims.birthdate.name(), "2001-07-13") // <4>
.sign();
String token = Jwt.issuer("https://example.com/issuer")
.upn("[email protected]")
.groups(new HashSet<>(Arrays.asList("User", "Admin")))
.claim(Claims.birthdate.name(), "2001-07-13")
.sign();
System.out.println(token);
System.exit(0);
}
}
----
Expand Down

0 comments on commit 6395740

Please sign in to comment.