Class RestGetTokenAction

java.lang.Object
org.elasticsearch.rest.BaseRestHandler
org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler
org.elasticsearch.xpack.security.rest.action.oauth2.RestGetTokenAction
All Implemented Interfaces:
org.elasticsearch.rest.RestHandler, org.elasticsearch.rest.RestRequestFilter

public final class RestGetTokenAction extends SecurityBaseRestHandler implements org.elasticsearch.rest.RestRequestFilter
An implementation of a OAuth2-esque API for retrieval of an access token. This API does not conform to the RFC completely as it uses XContent for the request body instead for form encoded data. This is a relatively common modification of the OAuth2 specification as this aspect does not make the most sense since the response body is expected to be JSON
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.elasticsearch.rest.BaseRestHandler

    org.elasticsearch.rest.BaseRestHandler.RestChannelConsumer, org.elasticsearch.rest.BaseRestHandler.Wrapper

    Nested classes/interfaces inherited from interface org.elasticsearch.rest.RestHandler

    org.elasticsearch.rest.RestHandler.Route
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.logging.log4j.Logger
     

    Fields inherited from class org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler

    licenseState, settings

    Fields inherited from class org.elasticsearch.rest.BaseRestHandler

    DEFAULT_INCLUDE_TYPE_NAME_POLICY, INCLUDE_TYPE_NAME_PARAMETER, MULTI_ALLOW_EXPLICIT_INDEX
  • Constructor Summary

    Constructors
    Constructor
    Description
    RestGetTokenAction(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.license.XPackLicenseState xPackLicenseState)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Exception
    checkFeatureAvailable(org.elasticsearch.rest.RestRequest request)
    Check whether the given request is allowed within the current license state and setup, and return the name of any unlicensed feature.
     
     
    protected org.elasticsearch.rest.BaseRestHandler.RestChannelConsumer
    innerPrepareRequest(org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.internal.node.NodeClient client)
    Implementers should implement this method as they normally would for BaseRestHandler.prepareRequest(RestRequest, NodeClient) and ensure that all request parameters are consumed prior to returning a value.
    List<org.elasticsearch.rest.RestHandler.Route>
     

    Methods inherited from class org.elasticsearch.xpack.security.rest.action.SecurityBaseRestHandler

    prepareRequest

    Methods inherited from class org.elasticsearch.rest.BaseRestHandler

    getUsageCount, handleRequest, mediaTypesValid, responseParams, responseParams, unrecognized

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.elasticsearch.rest.RestHandler

    allowsUnsafeBuffers, allowSystemIndexAccessByDefault, canTripCircuitBreaker, supportsContentStream

    Methods inherited from interface org.elasticsearch.rest.RestRequestFilter

    getFilteredRequest
  • Field Details

    • logger

      protected org.apache.logging.log4j.Logger logger
  • Constructor Details

    • RestGetTokenAction

      public RestGetTokenAction(org.elasticsearch.common.settings.Settings settings, org.elasticsearch.license.XPackLicenseState xPackLicenseState)
  • Method Details

    • routes

      public List<org.elasticsearch.rest.RestHandler.Route> routes()
      Specified by:
      routes in interface org.elasticsearch.rest.RestHandler
      Specified by:
      routes in class org.elasticsearch.rest.BaseRestHandler
    • getName

      public String getName()
      Specified by:
      getName in class org.elasticsearch.rest.BaseRestHandler
    • innerPrepareRequest

      protected org.elasticsearch.rest.BaseRestHandler.RestChannelConsumer innerPrepareRequest(org.elasticsearch.rest.RestRequest request, org.elasticsearch.client.internal.node.NodeClient client) throws IOException
      Description copied from class: SecurityBaseRestHandler
      Implementers should implement this method as they normally would for BaseRestHandler.prepareRequest(RestRequest, NodeClient) and ensure that all request parameters are consumed prior to returning a value. The returned value is not guaranteed to be executed unless security is licensed and all request parameters are known
      Specified by:
      innerPrepareRequest in class SecurityBaseRestHandler
      Throws:
      IOException
    • getFilteredFields

      public Set<String> getFilteredFields()
      Specified by:
      getFilteredFields in interface org.elasticsearch.rest.RestRequestFilter
    • checkFeatureAvailable

      protected Exception checkFeatureAvailable(org.elasticsearch.rest.RestRequest request)
      Description copied from class: SecurityBaseRestHandler
      Check whether the given request is allowed within the current license state and setup, and return the name of any unlicensed feature. By default this returns an exception if security is not enabled. Sub-classes can override this method if they have additional requirements.
      Overrides:
      checkFeatureAvailable in class SecurityBaseRestHandler
      Returns:
      null if all required features are available, otherwise an exception to be sent to the requestor