if (CredentialType.API_KEY.equals(infoCredential.getCredentialType())) { String fullApiKey = infoCredential.getCredentialKey();
if (CredentialType.API_KEY.equals(infoCredential.getCredentialType())) { String fullApiKey = infoCredential.getCredentialKey();
@Override public boolean doCredentialsMatch(AuthenticationToken authenticationToken, AuthenticationInfo authenticationInfo) { // // Token data UsernamePasswordCredentials token = (UsernamePasswordCredentials) authenticationToken; String tokenUsername = token.getUsername(); String tokenPassword = token.getPassword(); // // Info data LoginAuthenticationInfo info = (LoginAuthenticationInfo) authenticationInfo; User infoUser = (User) info.getPrincipals().getPrimaryPrincipal(); Credential infoCredential = (Credential) info.getCredentials(); // // Match token with info boolean credentialMatch = false; if (tokenUsername.equals(infoUser.getName()) && CredentialType.PASSWORD.equals(infoCredential.getCredentialType()) && BCrypt.checkpw(tokenPassword, infoCredential.getCredentialKey())) { credentialMatch = true; // FIXME: if true cache token password for authentication performance improvement } return credentialMatch; }
@Override public boolean doCredentialsMatch(AuthenticationToken authenticationToken, AuthenticationInfo authenticationInfo) { // // Token data UsernamePasswordCredentials token = (UsernamePasswordCredentials) authenticationToken; String tokenUsername = token.getUsername(); String tokenPassword = token.getPassword(); // // Info data LoginAuthenticationInfo info = (LoginAuthenticationInfo) authenticationInfo; User infoUser = (User) info.getPrincipals().getPrimaryPrincipal(); Credential infoCredential = (Credential) info.getCredentials(); // // Match token with info boolean credentialMatch = false; if (tokenUsername.equals(infoUser.getName()) && CredentialType.PASSWORD.equals(infoCredential.getCredentialType()) && BCrypt.checkpw(tokenPassword, infoCredential.getCredentialKey())) { credentialMatch = true; // FIXME: if true cache token password for authentication performance improvement } return credentialMatch; }
Credential credentialMatched = null; for (Credential c : credentialList.getItems()) { if (CredentialType.PASSWORD.equals(c.getCredentialType())) { credentialMatched = c; break;
Credential credentialMatched = null; for (Credential c : credentialList.getItems()) { if (CredentialType.PASSWORD.equals(c.getCredentialType())) { credentialMatched = c; break;
if (credential.getCredentialType().equals(CredentialType.PASSWORD)) { throw new KapuaExistingCredentialException(CredentialType.PASSWORD);
if (credential.getCredentialType().equals(CredentialType.PASSWORD)) { throw new KapuaExistingCredentialException(CredentialType.PASSWORD);