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