Package org.apache.sling.auth.oauth_client.support

# Class OAuthEnabledSlingServlet

java.lang.Object
javax.servlet.GenericServlet
org.apache.sling.api.servlets.SlingSafeMethodsServlet
org.apache.sling.api.servlets.SlingAllMethodsServlet
org.apache.sling.auth.oauth_client.support.OAuthEnabledSlingServlet

All Implemented Interfaces:
  `Serializable`, `javax.servlet.Servlet`, `javax.servlet.ServletConfig`

public abstract class OAuthEnabledSlingServlet extends org.apache.sling.api.servlets.SlingAllMethodsServlet
Support class for implementing OAuth-enabled servlets

Features:

- Handles OAuth token retrieval and refresh
- Starts the authentication flow if no token is available
- Handles invalid access tokens ( `isInvalidAccessTokenException(Exception)` )

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`OAuthEnabledSlingServlet(@NotNull ClientConnection connection, @NotNull OAuthTokenAccess tokenAccess)`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doDelete(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response)`
`protected void`
`doDeleteWithToken(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken)`
`protected void`
`doGeneric(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response)`
`protected void`
`doGenericWithToken(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken)`
`protected void`
`doGet(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response)`
`protected void`
`doGetWithToken(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken)`
`protected void`
`doPost(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response)`
`protected void`
`doPostWithToken(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken)`
`protected void`
`doPut(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response)`
`protected void`
`doPutWithToken(@NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken)`
`protected @NotNull String`
`getRedirectPath(@NotNull org.apache.sling.api.SlingHttpServletRequest request)`
`protected boolean`
`isInvalidAccessTokenException(Exception e)`

### Methods inherited from class org.apache.sling.api.servlets.SlingAllMethodsServlet

`getAllowedRequestMethods, isMethodValid, mayService`

### Methods inherited from class org.apache.sling.api.servlets.SlingSafeMethodsServlet

`doHead, doOptions, doTrace, getServletInfo, handleMethodNotImplemented, service, service`

### Methods inherited from class javax.servlet.GenericServlet

`destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log`

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

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

## Constructor Details

### OAuthEnabledSlingServlet

protected OAuthEnabledSlingServlet(@NotNull @NotNull ClientConnection connection, @NotNull @NotNull OAuthTokenAccess tokenAccess)

## Method Details

### doGet

protected void doGet(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException

Overrides:
  `doGet` in class `org.apache.sling.api.servlets.SlingSafeMethodsServlet`
Throws:
  `javax.servlet.ServletException`
  `IOException`

### doPost

protected void doPost(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException

Overrides:
  `doPost` in class `org.apache.sling.api.servlets.SlingAllMethodsServlet`
Throws:
  `javax.servlet.ServletException`
  `IOException`

### doDelete

protected void doDelete(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException

Overrides:
  `doDelete` in class `org.apache.sling.api.servlets.SlingAllMethodsServlet`
Throws:
  `javax.servlet.ServletException`
  `IOException`

### doPut

protected void doPut(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException

Overrides:
  `doPut` in class `org.apache.sling.api.servlets.SlingAllMethodsServlet`
Throws:
  `javax.servlet.ServletException`
  `IOException`

### doGeneric

protected void doGeneric(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response) throws javax.servlet.ServletException, IOException

Overrides:
  `doGeneric` in class `org.apache.sling.api.servlets.SlingSafeMethodsServlet`
Throws:
  `javax.servlet.ServletException`
  `IOException`

### getRedirectPath

@NotNull protected @NotNull String getRedirectPath(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request)

### doGetWithToken

protected void doGetWithToken(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken) throws IOException, javax.servlet.ServletException

Throws:
  `IOException`
  `javax.servlet.ServletException`

### doPostWithToken

protected void doPostWithToken(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken) throws IOException, javax.servlet.ServletException

Throws:
  `IOException`
  `javax.servlet.ServletException`

### doPutWithToken

protected void doPutWithToken(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken) throws IOException, javax.servlet.ServletException

Throws:
  `IOException`
  `javax.servlet.ServletException`

### doDeleteWithToken

protected void doDeleteWithToken(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken) throws IOException, javax.servlet.ServletException

Throws:
  `IOException`
  `javax.servlet.ServletException`

### doGenericWithToken

protected void doGenericWithToken(@NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull org.apache.sling.api.SlingHttpServletResponse response, String accessToken) throws IOException, javax.servlet.ServletException

Throws:
  `IOException`
  `javax.servlet.ServletException`

### isInvalidAccessTokenException

protected boolean isInvalidAccessTokenException(Exception e)