Search in sources :

Example 1 with NotSoOpaqueCredentials

use of org.apereo.portal.security.provider.NotSoOpaqueCredentials in project uPortal by Jasig.

the class PasswordCachingCasAssertionSecurityContext method getOpaqueCredentials.

@Override
public final IOpaqueCredentials getOpaqueCredentials() {
    log.debug("Invoking getOpacheCredentials()");
    if (this.cachedCredentials == null) {
        log.debug("Have no credentials, invoking superclass");
        return super.getOpaqueCredentials();
    }
    final NotSoOpaqueCredentials credentials = new CacheOpaqueCredentials();
    credentials.setCredentials(this.cachedCredentials);
    log.debug("Returning credentials");
    return credentials;
}
Also used : NotSoOpaqueCredentials(org.apereo.portal.security.provider.NotSoOpaqueCredentials)

Example 2 with NotSoOpaqueCredentials

use of org.apereo.portal.security.provider.NotSoOpaqueCredentials in project uPortal by Jasig.

the class CachedPasswordUserInfoService method getPassword.

/**
     * Retrieves the users password by iterating over the user's security contexts and returning the
     * first available cached password.
     *
     * @param baseContext The security context to start looking for a password from.
     * @return the users password
     */
private String getPassword(ISecurityContext baseContext) {
    String password = null;
    IOpaqueCredentials oc = baseContext.getOpaqueCredentials();
    if (oc instanceof NotSoOpaqueCredentials) {
        NotSoOpaqueCredentials nsoc = (NotSoOpaqueCredentials) oc;
        password = nsoc.getCredentials();
    }
    // If still no password, loop through subcontexts to find cached credentials
    Enumeration en = baseContext.getSubContexts();
    while (password == null && en.hasMoreElements()) {
        ISecurityContext subContext = (ISecurityContext) en.nextElement();
        password = this.getPassword(subContext);
    }
    return password;
}
Also used : Enumeration(java.util.Enumeration) IOpaqueCredentials(org.apereo.portal.security.IOpaqueCredentials) ISecurityContext(org.apereo.portal.security.ISecurityContext) NotSoOpaqueCredentials(org.apereo.portal.security.provider.NotSoOpaqueCredentials)

Aggregations

NotSoOpaqueCredentials (org.apereo.portal.security.provider.NotSoOpaqueCredentials)2 Enumeration (java.util.Enumeration)1 IOpaqueCredentials (org.apereo.portal.security.IOpaqueCredentials)1 ISecurityContext (org.apereo.portal.security.ISecurityContext)1