File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
src/main/java/info/unterrainer/oauthtokenmanager Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1010
1111<modelVersion >4.0.0</modelVersion >
1212<artifactId >oauth-token-manager</artifactId >
13- <version >1.0.7 </version >
13+ <version >1.0.9 </version >
1414<name >OauthTokenManager</name >
1515<packaging >jar</packaging >
1616
Original file line number Diff line number Diff line change @@ -85,7 +85,15 @@ private PublicKey fetchPublicKey(String jwksUrl) throws Exception {
8585return factory .generatePublic (spec );
8686}
8787
88- public void checkAccess (String accessToken ) {
88+ /**
89+ * Checks the access token and verifies its signature. If the token is valid,
90+ * returns a tenantId.
91+ *
92+ * @param accessToken
93+ * @return tenantId or null if the token is invalid or not present.
94+ * @throws Exception
95+ */
96+ public String checkAccess (String accessToken ) {
8997try {
9098TokenVerifier <AccessToken > tokenVerifier = persistUserInfoInContext (accessToken );
9199if (tokenVerifier == null )
@@ -102,6 +110,8 @@ public void checkAccess(String accessToken) {
102110
103111try {
104112tokenVerifier .verify ();
113+ AccessToken token = tokenVerifier .getToken ();
114+ return (String ) token .getOtherClaims ().get ("tenants_read" );
105115} catch (VerificationException e ) {
106116throw new ForbiddenException ();
107117}
You can’t perform that action at this time.
0 commit comments