public AuthorizationRequest authorize(AuthorizationRequest request) {
Authority[] authorities = getAuthorities();
boolean someoneCouldAuthorize = false;
for (int i = 0; i < authorities.length; i++) {
Authority authority = authorities[i];
if(authority.canAuthorize(request)) {
someoneCouldAuthorize = true;
request = authority.authorize(request);
// authorization failed, return null
if(request == null) {
return null;
}