protected void logout(boolean invalidateLoginCredential) { if (isLoggedIn()) { eventBridge.fireEvent(new PreLoggedOutEvent(this.account)); PostLoggedOutEvent postLoggedOutEvent = new PostLoggedOutEvent(this.account); unAuthenticate(invalidateLoginCredential); eventBridge.fireEvent(postLoggedOutEvent); } }
protected void handleUnsuccesfulLoginAttempt(Throwable e) { if (e != null) { if (UnexpectedCredentialException.class.isInstance(e)) { //X TODO discuss special handling of UnexpectedCredentialException } else if (UserAlreadyLoggedInException.class.isInstance(e)) { eventBridge.fireEvent(new AlreadyLoggedInEvent()); } else if (LockedAccountException.class.isInstance(e)) { eventBridge.fireEvent(new LockedAccountEvent()); } } if (AUTHENTICATION_LOGGER.isDebugEnabled()) { AUTHENTICATION_LOGGER.authenticationFailed(this.loginCredential.getUserId(), e); } eventBridge.fireEvent(new LoginFailedEvent(e)); }
protected void listenLogout(@Observes PostLoggedOutEvent plo) { Account account = plo.getAccount(); if (account instanceof AgoravaUser) { lfs.getCurrentRepository().clear(); } }
beanManager.fireEvent(new AlreadyLoggedInEvent()); return AuthenticationResult.SUCCESS; beanManager.fireEvent(new LoggedInEvent()); return AuthenticationResult.SUCCESS; beanManager.fireEvent(new LoginFailedEvent(null)); return AuthenticationResult.FAILED; beanManager.fireEvent(new LoginFailedEvent(e));
protected void postAuthenticate(Authenticator authenticator) { authenticator.postAuthenticate(); if (!authenticator.getStatus().equals(Authenticator.AuthenticationStatus.SUCCESS)) { return; } eventBridge.fireEvent(new PostAuthenticateEvent()); }
protected Account authenticate() throws AuthenticationException { Account validatedAccount = null; if (authenticating) { authenticating = false; //X TODO discuss it throw new IllegalStateException("Authentication already in progress."); } try { authenticating = true; eventBridge.fireEvent(new PreAuthenticateEvent()); Authenticator authenticator = getAuthenticator(); if (AUTHENTICATION_LOGGER.isDebugEnabled()) { AUTHENTICATION_LOGGER.debugf("Authentication is going to be performed by authenticator [%s]", authenticator); } authenticator.authenticate(); if (authenticator.getStatus() == null) { throw new AuthenticationException("Authenticator must return a valid authentication status"); } if (authenticator.getStatus() == Authenticator.AuthenticationStatus.SUCCESS) { validatedAccount = authenticator.getAccount(); postAuthenticate(authenticator); } } catch (AuthenticationException e) { throw e; } catch (Throwable ex) { throw new AuthenticationException("Authentication failed.", ex); } finally { authenticating = false; } return validatedAccount; }
protected void handleSuccessfulLoginAttempt(Account validatedAccount) { AUTHENTICATION_LOGGER.debugf("Authentication was successful for credentials [%s]. User id is [%s].", this.loginCredential.getCredential(), this.loginCredential.getUserId()); this.account = validatedAccount; securityLevel = getSecurityLevelManager().resolveSecurityLevel(); eventBridge.fireEvent(new LoggedInEvent()); }
protected void handleUnsuccesfulLoginAttempt(Throwable e) { if (e != null) { if (UnexpectedCredentialException.class.isInstance(e)) { //X TODO discuss special handling of UnexpectedCredentialException } else if (UserAlreadyLoggedInException.class.isInstance(e)) { eventBridge.fireEvent(new AlreadyLoggedInEvent()); } else if (LockedAccountException.class.isInstance(e)) { eventBridge.fireEvent(new LockedAccountEvent()); } } if (AUTHENTICATION_LOGGER.isDebugEnabled()) { AUTHENTICATION_LOGGER.authenticationFailed(this.loginCredential.getUserId(), e); } eventBridge.fireEvent(new LoginFailedEvent(e)); }
protected void logout(boolean invalidateLoginCredential) { if (isLoggedIn()) { beanManager.fireEvent(new PreLoggedOutEvent(this.user)); PostLoggedOutEvent postLoggedOutEvent = new PostLoggedOutEvent(this.user); unAuthenticate(invalidateLoginCredential); beanManager.fireEvent(postLoggedOutEvent); } }
protected void postAuthenticate(Authenticator activeAuthenticator) { activeAuthenticator.postAuthenticate(); if (!activeAuthenticator.getStatus().equals(AuthenticationStatus.SUCCESS)) { return; } beanManager.fireEvent(new PostAuthenticateEvent()); }
protected Account authenticate() throws AuthenticationException { Account validatedAccount = null; if (authenticating) { authenticating = false; //X TODO discuss it throw new IllegalStateException("Authentication already in progress."); } try { authenticating = true; eventBridge.fireEvent(new PreAuthenticateEvent()); Authenticator authenticator = getAuthenticator(); if (AUTHENTICATION_LOGGER.isDebugEnabled()) { AUTHENTICATION_LOGGER.debugf("Authentication is going to be performed by authenticator [%s]", authenticator); } authenticator.authenticate(); if (authenticator.getStatus() == null) { throw new AuthenticationException("Authenticator must return a valid authentication status"); } if (authenticator.getStatus() == Authenticator.AuthenticationStatus.SUCCESS) { validatedAccount = authenticator.getAccount(); postAuthenticate(authenticator); } } catch (AuthenticationException e) { throw e; } catch (Throwable ex) { throw new AuthenticationException("Authentication failed.", ex); } finally { authenticating = false; } return validatedAccount; }
protected void handleSuccessfulLoginAttempt(Account validatedAccount) { AUTHENTICATION_LOGGER.debugf("Authentication was successful for credentials [%s]. User id is [%s].", this.loginCredential.getCredential(), this.loginCredential.getUserId()); this.account = validatedAccount; securityLevel = getSecurityLevelManager().resolveSecurityLevel(); eventBridge.fireEvent(new LoggedInEvent()); }
protected void handleUnsuccesfulLoginAttempt(Throwable e) { if (e != null) { if (UnexpectedCredentialException.class.isInstance(e)) { //X TODO discuss special handling of UnexpectedCredentialException } else if (UserAlreadyLoggedInException.class.isInstance(e)) { eventBridge.fireEvent(new AlreadyLoggedInEvent()); } else if (LockedAccountException.class.isInstance(e)) { eventBridge.fireEvent(new LockedAccountEvent()); } } if (AUTHENTICATION_LOGGER.isDebugEnabled()) { AUTHENTICATION_LOGGER.authenticationFailed(this.loginCredential.getUserId(), e); } eventBridge.fireEvent(new LoginFailedEvent(e)); }
protected void logout(boolean invalidateLoginCredential) { if (isLoggedIn()) { eventBridge.fireEvent(new PreLoggedOutEvent(this.account)); PostLoggedOutEvent postLoggedOutEvent = new PostLoggedOutEvent(this.account); unAuthenticate(invalidateLoginCredential); eventBridge.fireEvent(postLoggedOutEvent); } }
protected void postAuthenticate(Authenticator authenticator) { authenticator.postAuthenticate(); if (!authenticator.getStatus().equals(Authenticator.AuthenticationStatus.SUCCESS)) { return; } eventBridge.fireEvent(new PostAuthenticateEvent()); }
protected Account authenticate() throws AuthenticationException { Account validatedAccount = null; if (authenticating) { authenticating = false; //X TODO discuss it throw new IllegalStateException("Authentication already in progress."); } try { authenticating = true; eventBridge.fireEvent(new PreAuthenticateEvent()); Authenticator authenticator = getAuthenticator(); if (AUTHENTICATION_LOGGER.isDebugEnabled()) { AUTHENTICATION_LOGGER.debugf("Authentication is going to be performed by authenticator [%s]", authenticator); } authenticator.authenticate(); if (authenticator.getStatus() == null) { throw new AuthenticationException("Authenticator must return a valid authentication status"); } if (authenticator.getStatus() == Authenticator.AuthenticationStatus.SUCCESS) { validatedAccount = authenticator.getAccount(); postAuthenticate(authenticator); } } catch (AuthenticationException e) { throw e; } catch (Throwable ex) { throw new AuthenticationException("Authentication failed.", ex); } finally { authenticating = false; } return validatedAccount; }
protected void handleSuccessfulLoginAttempt(Account validatedAccount) { AUTHENTICATION_LOGGER.debugf("Authentication was successful for credentials [%s]. User id is [%s].", this.loginCredential.getCredential(), this.loginCredential.getUserId()); this.account = validatedAccount; securityLevel = getSecurityLevelManager().resolveSecurityLevel(); eventBridge.fireEvent(new LoggedInEvent()); }
protected void logout(boolean invalidateLoginCredential) { if (isLoggedIn()) { eventBridge.fireEvent(new PreLoggedOutEvent(this.account)); PostLoggedOutEvent postLoggedOutEvent = new PostLoggedOutEvent(this.account); unAuthenticate(invalidateLoginCredential); eventBridge.fireEvent(postLoggedOutEvent); } }
protected void postAuthenticate(Authenticator authenticator) { authenticator.postAuthenticate(); if (!authenticator.getStatus().equals(Authenticator.AuthenticationStatus.SUCCESS)) { return; } eventBridge.fireEvent(new PostAuthenticateEvent()); }
beanManager.fireEvent(new PreAuthenticateEvent());