Search in sources :

Example 1 with OpenIDConnectIdP

use of com.tremolosecurity.idp.providers.OpenIDConnectIdP in project OpenUnison by TremoloSecurity.

the class OpenIDConnectToken method replaceState.

public void replaceState() throws Exception {
    HashMap<String, OpenIDConnectIdP> oidcIdPs = (HashMap<String, OpenIDConnectIdP>) GlobalEntries.getGlobalEntries().get(OpenIDConnectIdP.UNISON_OPENIDCONNECT_IDPS);
    OpenIDConnectIdP idp = oidcIdPs.get(this.idpName);
    try {
        this.oidcSession = idp.getSessionStore().getSession(this.oidcSession.getSessionID());
    } catch (Exception e) {
        logger.warn("Could not replace state");
    }
}
Also used : HashMap(java.util.HashMap) OpenIDConnectIdP(com.tremolosecurity.idp.providers.OpenIDConnectIdP) LDAPException(com.novell.ldap.LDAPException) ServletException(javax.servlet.ServletException) NoSuchPaddingException(javax.crypto.NoSuchPaddingException) MalformedURLException(java.net.MalformedURLException) IllegalBlockSizeException(javax.crypto.IllegalBlockSizeException) ProvisioningException(com.tremolosecurity.provisioning.core.ProvisioningException) IOException(java.io.IOException) MalformedClaimException(org.jose4j.jwt.MalformedClaimException) JoseException(org.jose4j.lang.JoseException) BadPaddingException(javax.crypto.BadPaddingException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) InvalidKeyException(java.security.InvalidKeyException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Example 2 with OpenIDConnectIdP

use of com.tremolosecurity.idp.providers.OpenIDConnectIdP in project OpenUnison by TremoloSecurity.

the class OpenIDConnectToken method getRefreshToken.

public String getRefreshToken() throws Exception {
    HashMap<String, OpenIDConnectIdP> idps = (HashMap<String, OpenIDConnectIdP>) GlobalEntries.getGlobalEntries().get(OpenIDConnectIdP.UNISON_OPENIDCONNECT_IDPS);
    OpenIDConnectIdP idp = idps.get(this.idpName);
    return idp.getSessionStore().getSession(this.oidcSession.getSessionID()).getRefreshToken();
}
Also used : HashMap(java.util.HashMap) OpenIDConnectIdP(com.tremolosecurity.idp.providers.OpenIDConnectIdP)

Example 3 with OpenIDConnectIdP

use of com.tremolosecurity.idp.providers.OpenIDConnectIdP in project OpenUnison by TremoloSecurity.

the class OpenIDConnectToken method refreshProxyToken.

public void refreshProxyToken(HttpServletRequest request) throws ServletException, MalformedURLException, MalformedClaimException, JoseException, LDAPException, ProvisioningException {
    AuthController ac = ((AuthController) request.getSession().getAttribute(ProxyConstants.AUTH_CTL));
    HashMap<String, OpenIDConnectIdP> idps = (HashMap<String, OpenIDConnectIdP>) GlobalEntries.getGlobalEntries().get(OpenIDConnectIdP.UNISON_OPENIDCONNECT_IDPS);
    OpenIDConnectIdP idp = idps.get(this.idpName);
    if (idp == null) {
        throw new ServletException("Could not find idp '" + this.idpName + "'");
    }
    generateClaimsData(ac, idp, request);
}
Also used : ServletException(javax.servlet.ServletException) HashMap(java.util.HashMap) OpenIDConnectIdP(com.tremolosecurity.idp.providers.OpenIDConnectIdP) AuthController(com.tremolosecurity.proxy.auth.AuthController)

Example 4 with OpenIDConnectIdP

use of com.tremolosecurity.idp.providers.OpenIDConnectIdP in project OpenUnison by TremoloSecurity.

the class ClearSessions method execute.

@Override
public void execute(ConfigManager cfg, JobExecutionContext job) throws ProvisioningException {
    String idpName = job.getJobDetail().getJobDataMap().getString("idpName");
    HashMap<String, OpenIDConnectIdP> oidcIdPs = (HashMap<String, OpenIDConnectIdP>) GlobalEntries.getGlobalEntries().get(OpenIDConnectIdP.UNISON_OPENIDCONNECT_IDPS);
    if (oidcIdPs == null) {
        logger.warn("No openid connect identity providers available yet");
        return;
    }
    OpenIDConnectIdP idp = oidcIdPs.get(idpName);
    idp.clearExpiredSessions();
}
Also used : HashMap(java.util.HashMap) OpenIDConnectIdP(com.tremolosecurity.idp.providers.OpenIDConnectIdP)

Example 5 with OpenIDConnectIdP

use of com.tremolosecurity.idp.providers.OpenIDConnectIdP in project OpenUnison by TremoloSecurity.

the class OpenIDConnectToken method generateToken.

public void generateToken(HttpServletRequest request) throws ServletException, JoseException, LDAPException, ProvisioningException, MalformedClaimException, UnsupportedEncodingException, IOException {
    AuthController ac = ((AuthController) request.getSession().getAttribute(ProxyConstants.AUTH_CTL));
    HashMap<String, OpenIDConnectIdP> idps = (HashMap<String, OpenIDConnectIdP>) GlobalEntries.getGlobalEntries().get(OpenIDConnectIdP.UNISON_OPENIDCONNECT_IDPS);
    OpenIDConnectIdP idp = idps.get(this.idpName);
    if (idp == null) {
        throw new ServletException("Could not find idp '" + this.idpName + "'");
    }
    generateClaimsData(ac, idp, request);
    UrlHolder holder = (UrlHolder) request.getAttribute(ProxyConstants.AUTOIDM_CFG);
    OpenIDConnectAccessToken accessToken = new OpenIDConnectAccessToken();
    oidcSession = idp.createUserSession(request, this.trustName, holder, idp.getTrusts().get(this.trustName), ac.getAuthInfo().getUserDN(), GlobalEntries.getGlobalEntries().getConfigManager(), accessToken, UUID.randomUUID().toString(), ac.getAuthInfo().getAuthChain());
}
Also used : ServletException(javax.servlet.ServletException) UrlHolder(com.tremolosecurity.config.util.UrlHolder) HashMap(java.util.HashMap) OpenIDConnectAccessToken(com.tremolosecurity.idp.providers.OpenIDConnectAccessToken) OpenIDConnectIdP(com.tremolosecurity.idp.providers.OpenIDConnectIdP) AuthController(com.tremolosecurity.proxy.auth.AuthController)

Aggregations

OpenIDConnectIdP (com.tremolosecurity.idp.providers.OpenIDConnectIdP)5 HashMap (java.util.HashMap)5 ServletException (javax.servlet.ServletException)3 AuthController (com.tremolosecurity.proxy.auth.AuthController)2 LDAPException (com.novell.ldap.LDAPException)1 UrlHolder (com.tremolosecurity.config.util.UrlHolder)1 OpenIDConnectAccessToken (com.tremolosecurity.idp.providers.OpenIDConnectAccessToken)1 ProvisioningException (com.tremolosecurity.provisioning.core.ProvisioningException)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 InvalidKeyException (java.security.InvalidKeyException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 BadPaddingException (javax.crypto.BadPaddingException)1 IllegalBlockSizeException (javax.crypto.IllegalBlockSizeException)1 NoSuchPaddingException (javax.crypto.NoSuchPaddingException)1 MalformedClaimException (org.jose4j.jwt.MalformedClaimException)1 JoseException (org.jose4j.lang.JoseException)1