* HTTP-Authorization-Header. Returns null if no guard exists or
* authorization against guard is successful, otherwise the Access-Guard is
* returned, which should force an unauthorized-response.
*/
public static Access check(Content content, String authorizationHeader) {
Access access = getGuard(content);
if (access != null) {
String userpass = Crypts
.decodeBasicAuthorization(authorizationHeader);
if (userpass == null) {
return access;
}
int index = userpass.indexOf(":");
String login = userpass.substring(0, index);
String password = userpass.substring(index + 1);
if (!(Validations.equals(access.getLogin(), login) && access
.hasPassword(password))) {
return access;
}
}
return null;