public AuthenticationException resolveException(LoginException e) { return new AuthenticationServiceException(e.getMessage(), e); } }
public AuthenticationException resolveException(LoginException e) { return new AuthenticationServiceException(e.getMessage(), e); } }
@Override public void destroy() { keytab = null; serverSubject = null; for (LoginContext loginContext : loginContexts) { try { loginContext.logout(); } catch (LoginException ex) { log.warn(ex, ex.getMessage()); } } loginContexts.clear(); }
/** * Performs a login using the specified principal and keytab. * * @throws LoginException if the login fails */ @Override public synchronized void login() throws LoginException { if (isLoggedIn()) { return; } try { // If it's the first time ever calling login then we need to initialize a new context if (loginContext == null) { LOGGER.debug("Initializing new login context..."); this.subject = new Subject(); this.loginContext = createLoginContext(subject); } loginContext.login(); loggedIn.set(true); LOGGER.debug("Successful login for {}", new Object[]{principal}); } catch (LoginException le) { throw new LoginException("Unable to login with " + principal + " due to: " + le.getMessage()); } }
/** * Performs a logout of the current user. * * @throws LoginException if the logout fails */ @Override public synchronized void logout() throws LoginException { if (!isLoggedIn()) { return; } try { loginContext.logout(); loggedIn.set(false); LOGGER.debug("Successful logout for {}", new Object[]{principal}); subject = null; loginContext = null; } catch (LoginException e) { throw new LoginException("Logout failed due to: " + e.getMessage()); } }
log.error( "[Principal={}]: Interrupted while trying to perform a subsequent expiring credential re-login after one or more initial re-login failures: re-login thread exiting now: {}", principalLogText(), String.valueOf(loginException.getMessage())); loginContextFactory.refresherThreadDone(); return;
loginContext.login(); } catch (LoginException e) { throw new UnauthenticatedException("Failed to login: " + e.getMessage(), e);
throw new ProcessException("Login failed due to: " + e.getMessage(), e); throw new ProcessException("Relogin check failed due to: " + e.getMessage(), e);
protected void checkKerberosServerAvailable(LoginException le) { String message = le.getMessage().toUpperCase(); if (message.contains("PORT UNREACHABLE") || message.contains("CANNOT LOCATE") || message.contains("CANNOT CONTACT") || message.contains("CANNOT FIND") || message.contains("UNKNOWN ERROR")) { throw new ModelException("Kerberos unreachable", le); } }
private void tryToAbortLogin(LdapLoginModule loginModule) { try { loginModule.abort(); } catch (LoginException ee) { LOGGER.warn("LDAP abort failed: {}", ee.getMessage()); } }
public AcegiSecurityException resolveException(LoginException e) { return new AuthenticationServiceException(e.getMessage(), e); } }
public AuthenticationException resolveException(LoginException e) { return new AuthenticationServiceException(e.getMessage(), e); } }
public AuthenticationException resolveException(LoginException e) { return new AuthenticationServiceException(e.getMessage(), e); } }
private void _checkAuthentication(String username, String password) throws LoginException { try { UsernamePasswordHandler handler = new UsernamePasswordHandler(username, password.toCharArray()); LoginContext loginContext; loginContext = new LoginContext(CustomJaasDeploymentServiceMBean.RHQ_USER_SECURITY_DOMAIN, handler); loginContext.login(); loginContext.getSubject().getPrincipals().iterator().next(); loginContext.logout(); } catch (javax.security.auth.login.LoginException e) { throw new LoginException(e.getMessage()); } }
public HTTPKerberosAuthInterceptor(String host, Map<String,String> krbOptions) { this.host = host; this.krbOptions = krbOptions; try { buildSubjectCredentials(); } catch (LoginException e) { throw new FailedRequestException(e.getMessage(), e); } }
private String getUserName() throws MetaException { try { return Utils.getUGI().getShortUserName(); } catch (LoginException e) { throw new MetaException("Failed to get username " + e.getMessage()); } catch (IOException e) { throw new MetaException("Failed to get username " + e.getMessage()); } }
private String getAuthorization(URI currentURI) { try { String spn = getCompleteServicePrincipalName(currentURI); Oid oid = new Oid(SPNEGO_OID); byte[] token = getToken(spn, oid); String encodedToken = new String(Base64.getEncoder().encode(token), StandardCharsets.UTF_8); return NEGOTIATE_SCHEME + " " + encodedToken; } catch (LoginException e) { throw new RuntimeException(e.getMessage(), e); } catch (GSSException e) { throw new RuntimeException(e.getMessage(), e); } }
private void secureLogin(JoinRequest joinRequest) { if (node.securityContext != null) { Credentials credentials = joinRequest.getCredentials(); if (credentials == null) { throw new SecurityException("Expecting security credentials, but credentials could not be found in join request"); } try { LoginContext loginContext = node.securityContext.createMemberLoginContext(credentials); loginContext.login(); } catch (LoginException e) { throw new SecurityException(format("Authentication has failed for %s@%s, cause: %s", credentials.getPrincipal(), credentials.getEndpoint(), e.getMessage())); } } }
/** * Extract the user from underlying auth subsystem * @return * @throws MetaException */ private String getUserName() throws MetaException { try { return Utils.getUGI().getShortUserName(); } catch (LoginException e) { throw new MetaException("Failed to get username " + e.getMessage()); } catch (IOException e) { throw new MetaException("Failed to get username " + e.getMessage()); } }
private JsonResponse doPrivilegedRequest(String method, String url, ArrayList<Header> headers, StringEntity entity) throws CygnusRuntimeError { try { LoginContext loginContext = new LoginContext("cygnus_krb5_login", new KerberosCallbackHandler(krb5User, krb5Password)); loginContext.login(); PrivilegedRequest req = new PrivilegedRequest(method, url, headers, entity); return createJsonResponse((HttpResponse) Subject.doAs(loginContext.getSubject(), req)); } catch (LoginException e) { throw new CygnusRuntimeError("Privileged request error", "LoginException", e.getMessage()); } // try catch } // doPrivilegedRequest