This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: JWT auth and feature flags (#428)
Co-authored-by: Shawn Sherwood <[email protected]> Co-authored-by: Sam Lichlyter <[email protected]>
- Loading branch information
1 parent
826914c
commit efa8bb0
Showing
42 changed files
with
2,035 additions
and
82 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
cerberus-core/src/main/java/com/nike/cerberus/error/AuthTokenTooLongException.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,12 @@ | ||
package com.nike.cerberus.error; | ||
|
||
public class AuthTokenTooLongException extends Exception { | ||
|
||
private AuthTokenTooLongException() { | ||
super(); | ||
} | ||
|
||
public AuthTokenTooLongException(String message) { | ||
super(message); | ||
} | ||
} |
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
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
25 changes: 25 additions & 0 deletions
25
cerberus-domain/src/main/java/com/nike/cerberus/domain/AuthTokenAcceptType.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,25 @@ | ||
/* | ||
* Copyright (c) 2021 Nike, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.nike.cerberus.domain; | ||
|
||
/** Enum used to distinguish between JWT and session token */ | ||
public enum AuthTokenAcceptType { | ||
JWT, | ||
SESSION, | ||
ALL | ||
} |
37 changes: 37 additions & 0 deletions
37
cerberus-domain/src/main/java/com/nike/cerberus/domain/AuthTokenInfo.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,37 @@ | ||
package com.nike.cerberus.domain; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
public interface AuthTokenInfo { | ||
String getId(); | ||
|
||
AuthTokenInfo setId(String id); | ||
|
||
OffsetDateTime getCreatedTs(); | ||
|
||
AuthTokenInfo setCreatedTs(OffsetDateTime createdTs); | ||
|
||
OffsetDateTime getExpiresTs(); | ||
|
||
AuthTokenInfo setExpiresTs(OffsetDateTime expiresTs); | ||
|
||
String getPrincipal(); | ||
|
||
AuthTokenInfo setPrincipal(String principal); | ||
|
||
String getPrincipalType(); | ||
|
||
AuthTokenInfo setPrincipalType(String principalType); | ||
|
||
Boolean getIsAdmin(); | ||
|
||
AuthTokenInfo setIsAdmin(Boolean admin); | ||
|
||
String getGroups(); | ||
|
||
AuthTokenInfo setGroups(String groups); | ||
|
||
Integer getRefreshCount(); | ||
|
||
AuthTokenInfo setRefreshCount(Integer refreshCount); | ||
} |
24 changes: 24 additions & 0 deletions
24
cerberus-domain/src/main/java/com/nike/cerberus/domain/AuthTokenIssueType.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,24 @@ | ||
/* | ||
* Copyright (c) 2021 Nike, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.nike.cerberus.domain; | ||
|
||
/** Enum used to distinguish between JWT and session token */ | ||
public enum AuthTokenIssueType { | ||
JWT, | ||
SESSION | ||
} |
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
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
Oops, something went wrong.