Skip to content

Commit

Permalink
feat(jans-keycloak-integration): enhancements to jans-keycloak-integr…
Browse files Browse the repository at this point in the history
…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
uprightech committed Jun 18, 2024
1 parent 76e79f3 commit 4f453ab
Show file tree
Hide file tree
Showing 24 changed files with 1,414 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.jans.kc.oidc;

public interface OIDCAccessToken {

}
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;
}

}
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);
}
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";
}
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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.jans.kc.oidc;

public interface OIDCRefreshToken {

}
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;
}
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;
}
}
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;
}
}
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);
}
}
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();
}
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;
}
}
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);
}
}
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();
}
Loading

0 comments on commit 4f453ab

Please sign in to comment.