Class CommandSecurityChecker

  • All Implemented Interfaces:
    org.glassfish.hk2.api.PostConstruct

    @Service
    @Singleton
    public class CommandSecurityChecker
    extends Object
    implements org.glassfish.hk2.api.PostConstruct
    Utility class which checks if the Subject is allowed to execute the specified command.

    The processing includes AccessRequired} annotations, CRUD commands, RestEndpoint annotations, and if the command class implements AdminCommandSecurity.AccessCheckProvider it also invokes the corresponding getAccessChecks method. To succeed the overall authorization all access checks - whether inferred from annotations or returned from getAccessChecks - for which isFailureFatal is true must pass.

    Author:
    tjquinn
    • Constructor Detail

      • CommandSecurityChecker

        public CommandSecurityChecker()
    • Method Detail

      • postConstruct

        public void postConstruct()
        Specified by:
        postConstruct in interface org.glassfish.hk2.api.PostConstruct
      • authorize

        public boolean authorize​(Subject subject,
                                 Map<String,​Object> env,
                                 org.glassfish.api.admin.AdminCommand command,
                                 org.glassfish.api.admin.AdminCommandContext adminCommandContext)
                          throws SecurityException
        Reports whether the Subject is allowed to perform the specified admin command.
        Parameters:
        subject - Subject for the current user to authorize
        env - environmental settings that might be used in the resource name expression
        command - the admin command the Subject wants to execute
        Returns:
        Throws:
        SecurityException