use of org.apache.catalina.realm.GenericPrincipal in project geode by apache.
the class DeltaSession7 method getSerializedPrincipal.
private byte[] getSerializedPrincipal() {
if (this.serializedPrincipal == null) {
if (this.principal != null && this.principal instanceof GenericPrincipal) {
GenericPrincipal gp = (GenericPrincipal) this.principal;
this.serializedPrincipal = serialize(gp);
if (manager != null) {
DeltaSessionManager mgr = (DeltaSessionManager) getManager();
if (mgr.getLogger().isDebugEnabled()) {
mgr.getLogger().debug(this + ": Serialized principal: " + gp);
}
}
}
}
return this.serializedPrincipal;
}
use of org.apache.catalina.realm.GenericPrincipal in project geode by apache.
the class DeltaSession8 method getSerializedPrincipal.
private byte[] getSerializedPrincipal() {
if (this.serializedPrincipal == null) {
if (this.principal != null && this.principal instanceof GenericPrincipal) {
GenericPrincipal gp = (GenericPrincipal) this.principal;
this.serializedPrincipal = serialize(gp);
if (manager != null) {
DeltaSessionManager mgr = (DeltaSessionManager) getManager();
if (mgr.getLogger().isDebugEnabled()) {
mgr.getLogger().debug(this + ": Serialized principal: " + gp);
}
}
}
}
return this.serializedPrincipal;
}
use of org.apache.catalina.realm.GenericPrincipal in project geode by apache.
the class DeltaSession method getSerializedPrincipal.
private byte[] getSerializedPrincipal() {
if (this.serializedPrincipal == null) {
if (this.principal != null && this.principal instanceof GenericPrincipal) {
GenericPrincipal gp = (GenericPrincipal) this.principal;
SerializablePrincipal sp = SerializablePrincipal.createPrincipal(gp);
this.serializedPrincipal = serialize(sp);
if (manager != null) {
DeltaSessionManager mgr = (DeltaSessionManager) getManager();
if (mgr.getLogger().isDebugEnabled()) {
mgr.getLogger().debug(this + ": Serialized principal: " + sp);
// mgr.logCurrentStack();
}
}
}
}
return this.serializedPrincipal;
}
use of org.apache.catalina.realm.GenericPrincipal in project oxCore by GluuFederation.
the class WantSslRealm method getPrincipal.
@Override
protected Principal getPrincipal(X509Certificate usercert) {
if (this.x509UsernameRetriever == null) {
return new GenericPrincipal(null, null, null);
}
String username = this.x509UsernameRetriever.getUsername(usercert);
Principal principal = new GenericPrincipal(username, null, null);
return principal;
}
use of org.apache.catalina.realm.GenericPrincipal in project tomcat70 by apache.
the class AuthenticatorBase method checkForCachedAuthentication.
/**
* Check to see if the user has already been authenticated earlier in the
* processing chain or if there is enough information available to
* authenticate the user without requiring further user interaction.
*
* @param request The current request
* @param response The current response
* @param useSSO Should information available from SSO be used to attempt
* to authenticate the current user?
*
* @return <code>true</code> if the user was authenticated via the cache,
* otherwise <code>false</code>
*/
protected boolean checkForCachedAuthentication(Request request, HttpServletResponse response, boolean useSSO) {
// Has the user already been authenticated?
Principal principal = request.getUserPrincipal();
String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE);
if (principal != null) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("authenticator.check.found", principal.getName()));
}
// invalidation at log out.
if (ssoId != null) {
associate(ssoId, request.getSessionInternal(true));
}
return true;
}
// Is there an SSO session against which we can try to reauthenticate?
if (useSSO && ssoId != null) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("authenticator.check.sso", ssoId));
}
/* Try to reauthenticate using data cached by SSO. If this fails,
either the original SSO logon was of DIGEST or SSL (which
we can't reauthenticate ourselves because there is no
cached username and password), or the realm denied
the user's reauthentication for some reason.
In either case we have to prompt the user for a logon */
if (reauthenticateFromSSO(ssoId, request)) {
return true;
}
}
// needs to be authorized?
if (request.getCoyoteRequest().getRemoteUserNeedsAuthorization()) {
String username = request.getCoyoteRequest().getRemoteUser().toString();
if (username != null) {
if (log.isDebugEnabled()) {
log.debug(sm.getString("authenticator.check.authorize", username));
}
Principal authorized = context.getRealm().authenticate(username);
if (authorized == null) {
// from the authenticated user name
if (log.isDebugEnabled()) {
log.debug(sm.getString("authenticator.check.authorizeFail", username));
}
authorized = new GenericPrincipal(username, null, null);
}
String authType = request.getAuthType();
if (authType == null || authType.length() == 0) {
authType = getAuthMethod();
}
register(request, response, authorized, authType, username, null);
return true;
}
}
return false;
}
Aggregations