use of com.sun.identity.authentication.server.AuthContextLocal in project OpenAM by OpenRock.
the class LoginState method createAuthContext.
/**
* Creates <code>AuthContextLocal</code> for new requests.
*
* @return the created <code>AuthContextLocal</code>
* @throws AuthException if fails to create <code>AuthContextLocal</code>
*/
public AuthContextLocal createAuthContext(SessionID sid, String orgName, HttpServletRequest req) throws AuthException {
this.userOrg = getDomainNameByOrg(orgName);
if (DEBUG.messageEnabled()) {
DEBUG.message("createAuthContext: userOrg is : " + userOrg);
}
if ((this.userOrg == null) || (this.userOrg.equals(""))) {
DEBUG.error("domain is null, error condtion");
logFailed(LazyConfig.AUTHD.bundle.getString("invalidDomain"), "INVALIDDOMAIN");
auditor.auditLoginFailure(this, INVALID_REALM);
throw new AuthException(AMAuthErrorCode.AUTH_INVALID_DOMAIN, null);
}
if (DEBUG.messageEnabled()) {
DEBUG.message("AuthUtil::getAuthContext::Creating new " + "AuthContextLocal & LoginState");
}
AuthContextLocal authContext = new AuthContextLocal(this.userOrg);
newRequest = true;
this.sid = sid;
if (DEBUG.messageEnabled()) {
DEBUG.message("requestType : " + newRequest);
DEBUG.message("sid : " + sid);
DEBUG.message("orgName passed: " + orgName);
}
try {
createSession(req, authContext);
} catch (Exception e) {
DEBUG.error("Exception creating session .. :", e);
throw new AuthException(AMAuthErrorCode.AUTH_ERROR, null);
}
amIdRepo = LazyConfig.AUTHD.getAMIdentityRepository(getOrgDN());
populateOrgProfile();
isLocaleSet = false;
return authContext;
}
use of com.sun.identity.authentication.server.AuthContextLocal in project OpenAM by OpenRock.
the class LoginState method createAuthContext.
/**
* Returns authentication context for new request.
*
* @return Authentication context for new request.
* @throws AuthException if it fails to instantiate <code>AuthContext</code>
*/
public AuthContextLocal createAuthContext(HttpServletRequest request, HttpServletResponse response, SessionID sid, Hashtable requestHash) throws AuthException {
// Get / Construct the Original Login URL
this.loginURL = AuthUtils.constructLoginURL(request);
// Get query param indicating a request "forward" after
// successful authentication.
this.forwardSuccess = AuthUtils.forwardSuccessExists(request);
// set the locale
setRequestLocale(request);
if (DEBUG.messageEnabled()) {
DEBUG.message("locale : " + localeContext.getLocale());
}
this.userOrg = getUserDomain(request, sid, requestHash);
if (DEBUG.messageEnabled()) {
DEBUG.message("createAuthContext: userOrg is : " + userOrg);
}
if ((this.userOrg == null) || this.userOrg.length() == 0) {
DEBUG.message("domain is null, error condtion");
logFailed(LazyConfig.AUTHD.bundle.getString("invalidDomain"), "INVALIDDOMAIN");
auditor.auditLoginFailure(this, INVALID_REALM);
throw new AuthException(AMAuthErrorCode.AUTH_INVALID_DOMAIN, null);
}
if (DEBUG.messageEnabled()) {
DEBUG.message("AuthUtil:getAuthContext:" + "Creating new AuthContextLocal & LoginState");
}
AuthContextLocal authContext = new AuthContextLocal(this.userOrg);
newRequest = true;
servletRequest = request;
servletResponse = response;
setParamHash(requestHash);
client = getClient();
this.sid = sid;
if (DEBUG.messageEnabled()) {
DEBUG.message("requestType : " + newRequest);
DEBUG.message("client : " + client);
DEBUG.message("sid : " + sid);
}
try {
createSession(request, authContext);
} catch (Exception e) {
DEBUG.error("Exception creating session .. :", e);
throw new AuthException(e);
}
String cookieSupport = AuthUtils.getCookieSupport(getClientType());
cookieDetect = AuthUtils.getCookieDetect(cookieSupport);
if ((cookieSupport != null) && cookieSupport.equals("false")) {
cookieSupported = false;
}
if (DEBUG.messageEnabled()) {
DEBUG.message("cookieSupport is : " + cookieSupport);
DEBUG.message("cookieDetect is .. : " + cookieDetect);
DEBUG.message("cookieSupported is .. : " + cookieSupported);
}
if (AuthUtils.isClientDetectionEnabled() && cookieDetect) {
cookieSet = true;
}
setDecodedGoToOnFailURL();
amIdRepo = LazyConfig.AUTHD.getAMIdentityRepository(getOrgDN());
populateOrgProfile();
populateGlobalProfile();
return authContext;
}
Aggregations