throws error on invalid policy
This commit is contained in:
parent
e9b6a7ad25
commit
b84b4fad81
|
@ -125,8 +125,14 @@ public class RequestValidator extends RequestHandler {
|
||||||
ServiceIdentifier serviceIdentifier = Utils.getServiceInfo(call.context()).getServiceIdentifier();
|
ServiceIdentifier serviceIdentifier = Utils.getServiceInfo(call.context()).getServiceIdentifier();
|
||||||
|
|
||||||
String callerId = AuthorizationProvider.instance.get().getClient().getId();
|
String callerId = AuthorizationProvider.instance.get().getClient().getId();
|
||||||
|
|
||||||
|
List<Policy> policies = null;
|
||||||
try {
|
try {
|
||||||
List<Policy> policies = authorizationService().getPolicies(scope);
|
authorizationService().getPolicies(scope);
|
||||||
|
}catch (Exception e) {
|
||||||
|
invalid_request_error.fire("error contating authorization");
|
||||||
|
}
|
||||||
|
|
||||||
for (Policy policy: policies) {
|
for (Policy policy: policies) {
|
||||||
log.debug("policy: {}", policy.getPolicyAsString() );
|
log.debug("policy: {}", policy.getPolicyAsString() );
|
||||||
|
|
||||||
|
@ -138,17 +144,14 @@ public class RequestValidator extends RequestHandler {
|
||||||
else if (entity.getExcludes().isEmpty())
|
else if (entity.getExcludes().isEmpty())
|
||||||
toReject = true;
|
toReject = true;
|
||||||
else toReject = !entity.getExcludes().contains(callerId);
|
else toReject = !entity.getExcludes().contains(callerId);
|
||||||
|
|
||||||
if (toReject) {
|
if (toReject) {
|
||||||
log.error("rejecting call to {} : {} is not allowed to contact the service ",context.name(), callerId);
|
log.error("rejecting call to {} : {} is not allowed to contact the service ",context.name(), callerId);
|
||||||
invalid_request_error.fire("rejecting call to "+context.name()+": "+callerId+" is not allowed to contact the service: "+serviceIdentifier.getServiceName() );
|
RequestError.request_not_authorized_error.fire("rejecting call to "+context.name()+": "+callerId+" is not allowed to contact the service: "+serviceIdentifier.getServiceName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
|
||||||
log.warn("error getting policies from context {}", scope, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TO resolve an error on Auth Portlet
|
//TO resolve an error on Auth Portlet
|
||||||
|
|
Loading…
Reference in New Issue