org.apache.nutch.api.security

## Class SecurityUtils

- java.lang.Object
- - org.apache.nutch.api.security.SecurityUtils

-     public final class SecurityUtils
      extends java.lang.Object

  Utility class for security operations for NutchServer REST API.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `allowOnlyAdmin(javax.ws.rs.core.SecurityContext securityContext)` Check for allowing only admin role
    `static org.restlet.security.MemoryRealm` | `constructRealm(org.restlet.ext.jaxrs.JaxRsApplication application, ConfManager configManager, java.lang.String confId)` Constructs realm
    `static java.util.List<org.restlet.security.Role>` | `getRoles(org.restlet.ext.jaxrs.JaxRsApplication application)` Returns roles defined at `AuthorizationRoleEnum` associated with `JaxRsApplication` type application

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getRoles

          public static java.util.List<org.restlet.security.Role> getRoles(org.restlet.ext.jaxrs.JaxRsApplication application)

      Returns roles defined at `AuthorizationRoleEnum` associated with `JaxRsApplication` type application
      Parameters:
        `application` - `JaxRsApplication` type application
      Returns:
        roles associated with given `JaxRsApplication` type application

    - #### constructRealm

          public static org.restlet.security.MemoryRealm constructRealm(org.restlet.ext.jaxrs.JaxRsApplication application,
                                                                        ConfManager configManager,
                                                                        java.lang.String confId)

      Constructs realm
      Parameters:
        `application` - `JaxRsApplication`application
        `configManager` - `ConfManager` type config manager
        `confId` - Configuration id to use from `ConfManager` type config manager
      Returns:
        realm

    - #### allowOnlyAdmin

          public static void allowOnlyAdmin(javax.ws.rs.core.SecurityContext securityContext)

      Check for allowing only admin role
      Parameters:
        `securityContext` - to check role of logged-in user

Copyright © 2019 The Apache Software Foundation