-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jans-keycloak-integration): enhancements to jans-keycloak-integr…
…ation #8614 * moved authenticator spi to spi module * minor refactoring to the authenticator spi Signed-off-by: Rolain Djeumen <uprightech@gmail.com>
- Loading branch information
1 parent
76e79f3
commit 4f453ab
Showing
24 changed files
with
1,414 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCAccessToken.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,5 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public interface OIDCAccessToken { | ||
|
||
} |
86 changes: 86 additions & 0 deletions
86
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCAuthRequest.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,86 @@ | ||
package io.jans.kc.oidc; | ||
|
||
import java.util.List; | ||
import java.util.ArrayList; | ||
|
||
public class OIDCAuthRequest { | ||
|
||
private String clientId; | ||
private String state; | ||
private String nonce; | ||
private List<String> scopes; | ||
private List<String> responseTypes; | ||
private String redirectUri; | ||
|
||
public OIDCAuthRequest() { | ||
|
||
this.clientId = null; | ||
this.state = null; | ||
this.nonce = null; | ||
this.scopes = new ArrayList<String>(); | ||
this.responseTypes = new ArrayList<String>(); | ||
this.redirectUri = null; | ||
} | ||
|
||
public String getClientId() { | ||
|
||
return this.clientId; | ||
} | ||
|
||
public void setClientId(String clientId) { | ||
|
||
this.clientId = clientId; | ||
} | ||
|
||
public void setState(String state) { | ||
|
||
this.state = state; | ||
} | ||
|
||
public final String getState() { | ||
|
||
return this.state; | ||
} | ||
|
||
public void setNonce(String nonce) { | ||
|
||
this.nonce = nonce; | ||
} | ||
|
||
public final String getNonce() { | ||
|
||
return this.nonce; | ||
} | ||
|
||
public void addScope(String scope) { | ||
|
||
this.scopes.add(scope); | ||
} | ||
|
||
public final List<String> getScopes() { | ||
|
||
return this.scopes; | ||
} | ||
|
||
public void addResponseType(String responseType) { | ||
|
||
this.responseTypes.add(responseType); | ||
} | ||
|
||
public final List<String> getResponseTypes() { | ||
|
||
return this.responseTypes; | ||
} | ||
|
||
|
||
public void setRedirectUri(String redirectUri) { | ||
|
||
this.redirectUri = redirectUri; | ||
} | ||
|
||
public String getRedirectUri() { | ||
|
||
return this.redirectUri; | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCMetaCache.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,6 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public interface OIDCMetaCache { | ||
public void put(String issuer, String key , Object value); | ||
public Object get(String issuer, String key); | ||
} |
7 changes: 7 additions & 0 deletions
7
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCMetaCacheKeys.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,7 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public class OIDCMetaCacheKeys { | ||
public static final String AUTHORIZATION_URL = "oidc.authorization.url"; | ||
public static final String TOKEN_URL = "oidc.token.url"; | ||
public static final String USERINFO_URL = "oidc.userinfo.url"; | ||
} |
12 changes: 12 additions & 0 deletions
12
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCMetaError.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 io.jans.kc.oidc; | ||
|
||
public class OIDCMetaError extends Exception { | ||
|
||
public OIDCMetaError(String message) { | ||
super(message); | ||
} | ||
|
||
public OIDCMetaError(String message, Throwable cause) { | ||
super(message,cause); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCRefreshToken.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,5 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public interface OIDCRefreshToken { | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCService.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,13 @@ | ||
package io.jans.kc.oidc; | ||
|
||
import java.net.URI; | ||
|
||
public interface OIDCService { | ||
|
||
public URI getAuthorizationEndpoint(String issuerUrl) throws OIDCMetaError; | ||
public URI getTokenEndpoint(String issuerUrl) throws OIDCMetaError; | ||
public URI getUserInfoEndpoint(String issuerUrl) throws OIDCMetaError; | ||
public URI createAuthorizationUrl(String issuerUrl, OIDCAuthRequest request) throws OIDCMetaError; | ||
public OIDCTokenResponse requestTokens(String issuerUrl, OIDCTokenRequest tokenreq) throws OIDCTokenRequestError; | ||
public OIDCUserInfoResponse requestUserInfo(String issuerUrl, OIDCAccessToken accesstoken) throws OIDCUserInfoRequestError; | ||
} |
30 changes: 30 additions & 0 deletions
30
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCTokenError.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,30 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public class OIDCTokenError { | ||
|
||
private String code; | ||
private String description; | ||
private int httpStatusCode; | ||
|
||
public OIDCTokenError(String code, String description, int httpStatusCode) { | ||
|
||
this.code = code; | ||
this.description = description; | ||
this.httpStatusCode = httpStatusCode; | ||
} | ||
|
||
public String code() { | ||
|
||
return this.code; | ||
} | ||
|
||
public String description() { | ||
|
||
return this.description; | ||
} | ||
|
||
public int httpStatusCode() { | ||
|
||
return this.httpStatusCode; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCTokenRequest.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,40 @@ | ||
package io.jans.kc.oidc; | ||
|
||
import java.net.URI; | ||
|
||
public class OIDCTokenRequest { | ||
|
||
private String code; | ||
//in the future , replace this with a client credentials | ||
//interface to support various authntication credential schemes | ||
private String clientId; | ||
private String clientSecret; | ||
private URI redirecturi; | ||
|
||
public OIDCTokenRequest(String code, String clientId,String clientSecret,URI redirecturi) { | ||
this.code = code; | ||
this.clientId = clientId; | ||
this.clientSecret = clientSecret; | ||
this.redirecturi = redirecturi; | ||
} | ||
|
||
public String getCode() { | ||
|
||
return this.code; | ||
} | ||
|
||
public String getClientId() { | ||
|
||
return this.clientId; | ||
} | ||
|
||
public String getClientSecret() { | ||
|
||
return this.clientSecret; | ||
} | ||
|
||
public URI getRedirectUri() { | ||
|
||
return this.redirecturi; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCTokenRequestError.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 io.jans.kc.oidc; | ||
|
||
public class OIDCTokenRequestError extends Exception { | ||
|
||
public OIDCTokenRequestError(String msg) { | ||
super(msg); | ||
} | ||
|
||
public OIDCTokenRequestError(String msg, Throwable cause) { | ||
super(msg,cause); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCTokenResponse.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,9 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public interface OIDCTokenResponse { | ||
|
||
public OIDCAccessToken accessToken(); | ||
public OIDCRefreshToken refreshToken(); | ||
public OIDCTokenError error(); | ||
public boolean indicatesSuccess(); | ||
} |
30 changes: 30 additions & 0 deletions
30
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCUserInfoError.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,30 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public class OIDCUserInfoError { | ||
|
||
private String code; | ||
private String description; | ||
private int httpStatusCode; | ||
|
||
public OIDCUserInfoError(String code, String description, int httpStatusCode) { | ||
|
||
this.code = code; | ||
this.description = description; | ||
this.httpStatusCode = httpStatusCode; | ||
} | ||
|
||
public String code() { | ||
|
||
return this.code; | ||
} | ||
|
||
public String description() { | ||
|
||
return this.description; | ||
} | ||
|
||
public int httpStatusCode() { | ||
|
||
return this.httpStatusCode; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCUserInfoRequestError.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,13 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public class OIDCUserInfoRequestError extends Exception { | ||
|
||
public OIDCUserInfoRequestError(String msg) { | ||
super(msg); | ||
} | ||
|
||
|
||
public OIDCUserInfoRequestError(String msg, Throwable cause) { | ||
super(msg,cause); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
jans-keycloak-integration/spi/src/main/java/io/jans/kc/oidc/OIDCUserInfoResponse.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,9 @@ | ||
package io.jans.kc.oidc; | ||
|
||
public interface OIDCUserInfoResponse { | ||
|
||
public String username(); | ||
public String email(); | ||
public boolean indicatesSuccess(); | ||
public OIDCUserInfoError error(); | ||
} |
Oops, something went wrong.