use of org.gluu.oxauth.model.common.SessionId in project oxAuth by GluuFederation.
the class AuthorizeAction method permissionGranted.
public void permissionGranted() {
final SessionId session = getSession();
permissionGranted(session);
}
use of org.gluu.oxauth.model.common.SessionId in project oxAuth by GluuFederation.
the class AuthorizeAction method permissionDenied.
public void permissionDenied() {
final SessionId session = getSession();
authorizeService.permissionDenied(session);
}
use of org.gluu.oxauth.model.common.SessionId in project oxAuth by GluuFederation.
the class ConsentGatheringSessionService method getConsentSession.
public SessionId getConsentSession(HttpServletRequest httpRequest, HttpServletResponse httpResponse, String userDn, boolean create) {
String cookieId = cookieService.getConsentSessionIdFromCookie(httpRequest);
log.trace("Cookie - consent_session_id: {}", cookieId);
if (StringUtils.isNotBlank(cookieId)) {
SessionId sessionId = sessionIdService.getSessionId(cookieId);
if (sessionId != null) {
log.trace("Loaded consent_session_id from cookie, session: {}", sessionId);
return sessionId;
} else {
log.error("Failed to load consent_session_id from cookie: {}", cookieId);
}
} else {
if (!create) {
log.error("consent_session_id cookie is not set.");
}
}
if (!create) {
return null;
}
log.trace("Generating new consent_session_id ...");
SessionId session = sessionIdService.generateUnauthenticatedSessionId(userDn);
cookieService.createCookieWithState(session.getId(), session.getSessionState(), session.getOPBrowserState(), httpRequest, httpResponse, CookieService.CONSENT_SESSION_ID_COOKIE_NAME);
log.trace("consent_session_id cookie created.");
return session;
}
use of org.gluu.oxauth.model.common.SessionId in project oxAuth by GluuFederation.
the class Authenticator method authenticate.
/**
* Tries to authenticate an user, returns <code>true</code> if the
* authentication succeed
*
* @return Returns <code>true</code> if the authentication succeed
*/
public boolean authenticate() {
HttpServletRequest servletRequest = (HttpServletRequest) facesContext.getExternalContext().getRequest();
final SessionId sessionId = getSessionId(servletRequest);
if (sessionIdService.isSessionIdAuthenticated(sessionId)) {
// #1029 : session is already authenticated, we run into second authorization
// request
errorHandlerService.handleError("login.userAlreadyAuthenticated", AuthorizeErrorResponseType.RETRY, "Session is already authenticated. Please re-send authorization request. If AS errorHandlingMethod=remote then RP can get redirect with error and re-send authorization request automatically.");
return false;
}
lastResult = authenticateImpl(servletRequest, true, false, false);
if (Constants.RESULT_SUCCESS.equals(lastResult)) {
return true;
} else if (Constants.RESULT_FAILURE.equals(lastResult)) {
authenticationFailed();
} else if (Constants.RESULT_NO_PERMISSIONS.equals(lastResult)) {
handlePermissionsError();
} else if (Constants.RESULT_EXPIRED.equals(lastResult)) {
handleSessionInvalid();
} else if (Constants.RESULT_AUTHENTICATION_FAILED.equals(lastResult)) {
// Do nothing to keep compatibility with older versions
if (facesMessages.getMessages().size() == 0) {
addMessage(FacesMessage.SEVERITY_ERROR, "login.failedToAuthenticate");
}
}
return false;
}
use of org.gluu.oxauth.model.common.SessionId in project oxAuth by GluuFederation.
the class Authenticator method getFullNumber.
private String getFullNumber() {
String phone = null;
SessionId sessionId = sessionIdService.getSessionId();
if (sessionId != null) {
if (phone == null || phone.isEmpty()) {
phone = sessionId.getSessionAttributes().get("mobile_number");
}
if (phone == null || phone.isEmpty()) {
phone = sessionId.getSessionAttributes().get("mobile");
}
}
return phone == null ? "UNKNOW USER PHONE." : phone;
}
Aggregations