org.keycloak.services.resources

## Class AbstractSecuredLocalService

- java.lang.Object
- - org.keycloak.services.resources.AbstractSecuredLocalService

- Direct Known Subclasses:
    AccountService

      public abstract class AbstractSecuredLocalService
      extends Object

  Helper class for securing local services. Provides login basics as well as CSRF check basics
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Auth` | `auth`
    `protected ClientModel` | `client`
    `protected ClientConnection` | `clientConnection`
    `protected javax.ws.rs.core.HttpHeaders` | `headers`
    `protected RealmModel` | `realm`
    `protected org.jboss.resteasy.spi.HttpRequest` | `request`
    `protected KeycloakSession` | `session`
    `protected String` | `stateChecker`
    `protected javax.ws.rs.core.UriInfo` | `uriInfo`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractSecuredLocalService(RealmModel realm, ClientModel client)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected javax.ws.rs.core.Response` | `authenticateBrowser()`
    `protected void` | `csrfCheck(javax.ws.rs.core.MultivaluedMap<String,String> formData)` Check to see if form post has sessionId hidden field and match it against the session id.
    `protected void` | `csrfCheck(String stateChecker)` Check to see if form post has sessionId hidden field and match it against the session id.
    `protected abstract URI` | `getBaseRedirectUri()`
    `protected abstract Set<String>` | `getValidPaths()`
    `protected javax.ws.rs.core.Response` | `login(String path)`
    `javax.ws.rs.core.Response` | `loginRedirect(String code, String state, String error, String path, String referrer, javax.ws.rs.core.HttpHeaders headers)`
    `protected void` | `updateCsrfChecks()`

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

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

- - ### Field Detail

    - #### client

          protected final ClientModel client

    - #### realm

          protected RealmModel realm

    - #### uriInfo

          @Context
          protected javax.ws.rs.core.UriInfo uriInfo

    - #### headers

          @Context
          protected javax.ws.rs.core.HttpHeaders headers

    - #### clientConnection

          @Context
          protected ClientConnection clientConnection

    - #### stateChecker

          protected String stateChecker

    - #### session

          @Context
          protected KeycloakSession session

    - #### request

          @Context
          protected org.jboss.resteasy.spi.HttpRequest request

    - #### auth

          protected Auth auth

  - ### Constructor Detail

    - #### AbstractSecuredLocalService

          public AbstractSecuredLocalService(RealmModel realm,
                                             ClientModel client)

  - ### Method Detail

    - #### loginRedirect

          @Path(value="login-redirect")
           @GET
          public javax.ws.rs.core.Response loginRedirect(@QueryParam(value="code")
                                                                                             String code,
                                                                                             @QueryParam(value="state")
                                                                                             String state,
                                                                                             @QueryParam(value="error")
                                                                                             String error,
                                                                                             @QueryParam(value="path")
                                                                                             String path,
                                                                                             @QueryParam(value="referrer")
                                                                                             String referrer,
                                                                                             @Context
                                                                                             javax.ws.rs.core.HttpHeaders headers)

    - #### updateCsrfChecks

          protected void updateCsrfChecks()

    - #### getValidPaths

          protected abstract Set<String> getValidPaths()

    - #### csrfCheck

          protected void csrfCheck(javax.ws.rs.core.MultivaluedMap<String,String> formData)

      Check to see if form post has sessionId hidden field and match it against the session id.
      Parameters:
        `formData` -

    - #### csrfCheck

          protected void csrfCheck(String stateChecker)

      Check to see if form post has sessionId hidden field and match it against the session id.

    - #### getBaseRedirectUri

          protected abstract URI getBaseRedirectUri()

    - #### login

          protected javax.ws.rs.core.Response login(String path)

    - #### authenticateBrowser

          protected javax.ws.rs.core.Response authenticateBrowser()

Copyright © 2016 JBoss by Red Hat. All rights reserved.