@Secures @Restrict public boolean checkExpression(InvocationContext invocationContext) { Restrict restrict = getAnnotation(invocationContext, Restrict.class); String expression = restrict.value(); Object result = this.elProcessor.eval(expression); if (Boolean.class.isInstance(result)) { return Boolean.valueOf(result.toString()); } return false; }
@Secures @Restrict public boolean checkExpression(InvocationContext invocationContext) { Restrict restrict = getAnnotation(invocationContext, Restrict.class); String expression = restrict.value(); Object result = this.elProcessor.eval(expression); if (Boolean.class.isInstance(result)) { return Boolean.valueOf(result.toString()); } return false; }
@Secures @LoggedIn public boolean isLoggedIn(InvocationContext invocationContext) { LoggedIn loggedIn = getAnnotation(invocationContext, LoggedIn.class); Class<? extends Account> accountType = Account.class; if (loggedIn != null) { accountType = loggedIn.requiresAccount(); } Account account = getIdentity().getAccount(); return account != null && accountType.isInstance(account); }
@Secures @LoggedIn public boolean isLoggedIn(InvocationContext invocationContext) { LoggedIn loggedIn = getAnnotation(invocationContext, LoggedIn.class); Class<? extends Account> accountType = Account.class; if (loggedIn != null) { accountType = loggedIn.requiresAccount(); } Account account = getIdentity().getAccount(); return account != null && accountType.isInstance(account); }
@Secures @LoggedIn public boolean isLoggedIn(InvocationContext invocationContext) { LoggedIn loggedIn = getAnnotation(invocationContext, LoggedIn.class); Class<? extends Account> accountType = Account.class; if (loggedIn != null) { accountType = loggedIn.requiresAccount(); } Account account = getIdentity().getAccount(); return account != null && accountType.isInstance(account); }
@Secures @RolesAllowed public boolean hasRole(InvocationContext invocationContext) { RolesAllowed rolesAllowed = getAnnotation(invocationContext, RolesAllowed.class); for (String roleName : rolesAllowed.value()) { if (AuthorizationUtil.hasRole(getIdentity(), this.partitionManager, roleName)) { return true; } } return false; }
@Secures @GroupsAllowed public boolean isMember(InvocationContext invocationContext) { GroupsAllowed groupsAllowed = getAnnotation(invocationContext, GroupsAllowed.class); String[] groupNames = groupsAllowed.value(); for (String groupName : groupNames) { if (AuthorizationUtil.isMember(getIdentity(), this.partitionManager, groupName)) { return true; } } return false; }
@Secures @RolesAllowed public boolean hasRole(InvocationContext invocationContext) { RolesAllowed rolesAllowed = getAnnotation(invocationContext, RolesAllowed.class); for (String roleName : rolesAllowed.value()) { if (AuthorizationUtil.hasRole(getIdentity(), this.partitionManager, roleName)) { return true; } } return false; }
@Secures @RolesAllowed public boolean hasRole(InvocationContext invocationContext) { RolesAllowed rolesAllowed = getAnnotation(invocationContext, RolesAllowed.class); for (String roleName : rolesAllowed.value()) { if (AuthorizationUtil.hasRole(getIdentity(), this.partitionManager, roleName)) { return true; } } return false; }
@Secures @GroupsAllowed public boolean isMember(InvocationContext invocationContext) { GroupsAllowed groupsAllowed = getAnnotation(invocationContext, GroupsAllowed.class); String[] groupNames = groupsAllowed.value(); for (String groupName : groupNames) { if (AuthorizationUtil.isMember(getIdentity(), this.partitionManager, groupName)) { return true; } } return false; }
@Secures @GroupsAllowed public boolean isMember(InvocationContext invocationContext) { GroupsAllowed groupsAllowed = getAnnotation(invocationContext, GroupsAllowed.class); String[] groupNames = groupsAllowed.value(); for (String groupName : groupNames) { if (AuthorizationUtil.isMember(getIdentity(), this.partitionManager, groupName)) { return true; } } return false; }
@Secures @PartitionsAllowed public boolean hasPartition(InvocationContext invocationContext) { PartitionsAllowed partitionsAllowed = getAnnotation(invocationContext, PartitionsAllowed.class); String[] partitionNames = partitionsAllowed.name(); Class<? extends Partition> partitionType = partitionsAllowed.type(); return AuthorizationUtil.hasPartition(getIdentity(), partitionType, partitionNames); }
@Secures @PartitionsAllowed public boolean hasPartition(InvocationContext invocationContext) { PartitionsAllowed partitionsAllowed = getAnnotation(invocationContext, PartitionsAllowed.class); String[] partitionNames = partitionsAllowed.name(); Class<? extends Partition> partitionType = partitionsAllowed.type(); return AuthorizationUtil.hasPartition(getIdentity(), partitionType, partitionNames); }
@Secures @PartitionsAllowed public boolean hasPartition(InvocationContext invocationContext) { PartitionsAllowed partitionsAllowed = getAnnotation(invocationContext, PartitionsAllowed.class); String[] partitionNames = partitionsAllowed.name(); Class<? extends Partition> partitionType = partitionsAllowed.type(); return AuthorizationUtil.hasPartition(getIdentity(), partitionType, partitionNames); }
@Secures @RequiresPermission public boolean hasPermission(InvocationContext invocationContext) { RequiresPermission requiresPermission = getAnnotation(invocationContext, RequiresPermission.class); String resource = requiresPermission.resource(); Class<?> resourceClass = requiresPermission.resourceClass(); String resourceIdentifier = requiresPermission.resourceIdentifier(); String operation = requiresPermission.operation(); return AuthorizationUtil.hasPermission(getIdentity(), resource, resourceClass, resourceIdentifier, operation); }
@Secures @RequiresPermission public boolean hasPermission(InvocationContext invocationContext) { RequiresPermission requiresPermission = getAnnotation(invocationContext, RequiresPermission.class); String resource = requiresPermission.resource(); Class<?> resourceClass = requiresPermission.resourceClass(); String resourceIdentifier = requiresPermission.resourceIdentifier(); String operation = requiresPermission.operation(); return AuthorizationUtil.hasPermission(getIdentity(), resource, resourceClass, resourceIdentifier, operation); }
@Secures @RequiresLevel public boolean hasLevel(InvocationContext invocationContext){ RequiresLevel requireslevel = getAnnotation(invocationContext,RequiresLevel.class); String level = requireslevel.value(); Level requiredLevel = abstractFactory.resolve().createLevel(level); if (!AuthorizationUtil.hasLevel(identity, requiredLevel)){ throw new InsufficientSecurityLevelException(requiredLevel, "Expected security level is: " + requiredLevel + " but the current level is: " +identity.getLevel()); } return true; }
@Secures @RequiresLevel public boolean hasLevel(InvocationContext invocationContext){ RequiresLevel requireslevel = getAnnotation(invocationContext,RequiresLevel.class); String level = requireslevel.value(); Level requiredLevel = abstractFactory.resolve().createLevel(level); if (!AuthorizationUtil.hasLevel(identity, requiredLevel)){ throw new InsufficientSecurityLevelException(requiredLevel, "Expected security level is: " + requiredLevel + " but the current level is: " +identity.getLevel()); } return true; }
@Secures @RequiresLevel public boolean hasLevel(InvocationContext invocationContext){ RequiresLevel requireslevel = getAnnotation(invocationContext,RequiresLevel.class); String level = requireslevel.value(); Level requiredLevel = abstractFactory.resolve().createLevel(level); if (!AuthorizationUtil.hasLevel(identity, requiredLevel)){ throw new InsufficientSecurityLevelException(requiredLevel, "Expected security level is: " + requiredLevel + " but the current level is: " +identity.getLevel()); } return true; }
@Secures @RequiresPermission public boolean hasPermission(InvocationContext invocationContext) { RequiresPermission requiresPermission = getAnnotation(invocationContext, RequiresPermission.class); String resource = requiresPermission.resource(); Class<?> resourceClass = requiresPermission.resourceClass(); String resourceIdentifier = requiresPermission.resourceIdentifier(); String operation = requiresPermission.operation(); return AuthorizationUtil.hasPermission(getIdentity(), resource, resourceClass, resourceIdentifier, operation); }