if (idx < (authDecoded.length() - 1)) {
password = authDecoded.substring(idx + 1);
}
}
AuthorizationPolicy policy = pp == null
? new AuthorizationPolicy() : new PrincipalAuthorizationPolicy(pp);
policy.setUserName(username);
policy.setPassword(password);
policy.setAuthorizationType(authType);
return policy;
} catch (Base64Exception ex) {
// Invalid authentication => treat as not authenticated or use the Principal
}
}
if (pp != null) {
AuthorizationPolicy policy = new PrincipalAuthorizationPolicy(pp);
policy.setUserName(pp.getName());
policy.setAuthorization(credentials);
policy.setAuthorizationType(authType);
return policy;
}
return null;
}