if(rolesAllowed != null) {
if(rolesAllowed.value().length == 0) {
//FIXME handle monitor or error
}
AuthorizationPolicy policy = new AuthorizationPolicy();
policy.setAccessControl(AuthorizationPolicy.AcessControl.allow);
for(String role : rolesAllowed.value()) {
policy.getRoleNames().add(role);
}
ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
confOp.setName(method.getName());
((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
PolicySet policySet = policyFactory.createPolicySet();
policySet.setName(ALLOW);
policySet.getPolicies().add(policy);
policySet.setUnresolved(false);
confOp.getPolicySets().add(policySet);
}
PermitAll permitAll = method.getAnnotation(javax.annotation.security.PermitAll.class);
if(permitAll != null) {
AuthorizationPolicy policy = new AuthorizationPolicy();
policy.setAccessControl(AuthorizationPolicy.AcessControl.permitAll);
ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
confOp.setName(method.getName());
((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
PolicySet policySet = policyFactory.createPolicySet();
policySet.setName(PERMIT_ALL);
policySet.getPolicies().add(policy);
policySet.setUnresolved(false);
confOp.getPolicySets().add(policySet);
}
DenyAll denyAll = method.getAnnotation(javax.annotation.security.DenyAll.class);
if(denyAll != null) {
AuthorizationPolicy policy = new AuthorizationPolicy();
policy.setAccessControl(AuthorizationPolicy.AcessControl.denyAll);
ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
confOp.setName(method.getName());
((OperationsConfigurator)type).getConfiguredOperations().add(confOp);