-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add constants for JWT claim names and audiences
- Loading branch information
1 parent
274310c
commit ed27711
Showing
7 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/com/contentgrid/gateway/runtime/security/jwt/ContentGridAudiences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.contentgrid.gateway.runtime.security.jwt; | ||
|
||
import com.contentgrid.gateway.runtime.application.ApplicationId; | ||
import lombok.experimental.UtilityClass; | ||
|
||
@UtilityClass | ||
public class ContentGridAudiences { | ||
|
||
/** | ||
* Audience for the 'authentication' endpoint | ||
* @see <a href="https://github.com/xenit-eu/contentgrid-system-design/blob/main/specs/automation-extension-authentication.md#client-facing-token-exchange">Automation extension authentication spec</a> | ||
*/ | ||
public static final String SYSTEM_ENDPOINT_AUTHENTICATION = systemEndpoint("authentication"); | ||
|
||
public static String systemEndpoint(String endpointId) { | ||
return "contentgrid:system:endpoints:"+endpointId; | ||
} | ||
|
||
/** | ||
* Audience for an application | ||
* | ||
* @see <a href="https://github.com/xenit-eu/contentgrid-system-design/blob/main/specs/automation-extension-authentication.md#gateway-extension">Automation extension authentication spec</a> | ||
*/ | ||
public static String application(ApplicationId applicationId) { | ||
return "contentgrid:application:"+applicationId.getValue(); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/com/contentgrid/gateway/runtime/security/jwt/ContentGridClaimNames.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.contentgrid.gateway.runtime.security.jwt; | ||
|
||
import lombok.experimental.UtilityClass; | ||
|
||
@UtilityClass | ||
public class ContentGridClaimNames { | ||
|
||
/** | ||
* Contains encrypted claims of the principal in a delegated authentication token | ||
* @see <a href="https://github.com/xenit-eu/contentgrid-system-design/blob/main/specs/automation-extension-authentication.md#additional-jwt-claims">Automation extension authentication spec</a> | ||
*/ | ||
public static final String RESTRICT_PRINCIPAL_CLAIMS = "restrict:principal_claims"; | ||
|
||
/** | ||
* The application ID ({@link com.contentgrid.gateway.runtime.application.ApplicationId}) for which the token is valid | ||
* @see <a href="https://github.com/xenit-eu/contentgrid-system-design/blob/main/specs/automation-extension-authentication.md#additional-jwt-claims">Automation extension authentication spec</a> | ||
*/ | ||
public static final String CONTEXT_APPLICATION_ID = "context:application:id"; | ||
|
||
/** | ||
* All domain names belonging to the application for which the token is valid | ||
* @see <a href="https://github.com/xenit-eu/contentgrid-system-design/blob/main/specs/automation-extension-authentication.md#additional-jwt-claims">Automation extension authentication spec</a> | ||
*/ | ||
public static final String CONTEXT_APPLICATION_DOMAINS = "context:application:domains"; | ||
|
||
/** | ||
* Contains the claims of the actor in a delegated authentication token | ||
* @see <a href="https://www.rfc-editor.org/rfc/rfc8693.html#name-act-actor-claim">RFC8693</a> | ||
*/ | ||
public static final String ACT = "act"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters