private boolean isResourceAnnotationSatisfied(AuthorizeResource annotation) { if (annotation != null) { // we have an annotation => we must check for the required roles return hasAny(new Roles(annotation.value())); } else { // no annotation => no required roles => this resource can be accessed return true; } } }
private boolean isResourceAnnotationSatisfied(AuthorizeResource annotation) { if (annotation != null) { // we have an annotation => we must check for the required roles return hasAny(new Roles(annotation.value())); } else { // no annotation => no required roles => this resource can be accessed return true; } } }
/** * Check if annotated instantiation is allowed. * * @param authorizeInstantiationAnnotation * The annotations information * @return False if the instantiation is not authorized */ private <T extends IRequestableComponent> boolean check( final AuthorizeInstantiation authorizeInstantiationAnnotation) { // We are authorized unless we are found not to be boolean authorized = true; // Check class annotation first because it is more specific than package annotation if (authorizeInstantiationAnnotation != null) { authorized = hasAny(new Roles(authorizeInstantiationAnnotation.value())); } return authorized; }
/** * Check if annotated instantiation is allowed. * * @param authorizeInstantiationAnnotation * The annotations information * @return False if the instantiation is not authorized */ private <T extends IRequestableComponent> boolean check( final AuthorizeInstantiation authorizeInstantiationAnnotation) { // We are authorized unless we are found not to be boolean authorized = true; // Check class annotation first because it is more specific than package annotation if (authorizeInstantiationAnnotation != null) { authorized = hasAny(new Roles(authorizeInstantiationAnnotation.value())); } return authorized; }
/** * @param action * The action to check * @param authorizeActionAnnotation * The annotations information * @return False if the action is not authorized */ private boolean check(final Action action, final AuthorizeAction authorizeActionAnnotation) { if (authorizeActionAnnotation != null) { if (action.getName().equals(authorizeActionAnnotation.action())) { Roles deniedRoles = new Roles(authorizeActionAnnotation.deny()); if (isEmpty(deniedRoles) == false && hasAny(deniedRoles)) { return false; } Roles acceptedRoles = new Roles(authorizeActionAnnotation.roles()); if (!hasAny(acceptedRoles)) { return false; } } } return true; }
/** * @param action * The action to check * @param authorizeActionAnnotation * The annotations information * @return False if the action is not authorized */ private boolean check(final Action action, final AuthorizeAction authorizeActionAnnotation) { if (authorizeActionAnnotation != null) { if (action.getName().equals(authorizeActionAnnotation.action())) { Roles deniedRoles = new Roles(authorizeActionAnnotation.deny()); if (isEmpty(deniedRoles) == false && hasAny(deniedRoles)) { return false; } Roles acceptedRoles = new Roles(authorizeActionAnnotation.roles()); if (!hasAny(acceptedRoles)) { return false; } } } return true; }