Interface ClientFactory

All Known Implementing Classes:
DefaultClientFactory

public interface ClientFactory
Client factory interface, providing methods required to log in into the server. Factory methods are passed client name if available, i.e. if client HTTP session is authorised. All session HTTP headers are passed every method.
Author:
joe
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Identifies client attribute name, used as key to store client name in session attributes.
    default <T extends Client>
    T
    createGuestClient(Class<T> clientClass, org.springframework.http.HttpHeaders headers, Map<String,Object> attributes)
    Create a new guest client, called only if server configuration allows for anonymous guest clients, and client name (security principal) is unknown.
    <T extends Client>
    T
    findClient(Class<T> clientClass, Principal principal, VRObjectRepository db, org.springframework.http.HttpHeaders headers, Map<String,Object> attributes)
    Find an authorised known client, called only if security principal is known.
    default <T extends Client>
    T
    handleUnknownClient(Class<T> clientClass, org.springframework.http.HttpHeaders headers, Map<String,Object> attributes)
    Called if guest clients are not allowed, and user name (security principal) is unknown.
  • Field Details

  • Method Details

    • findClient

      <T extends Client> T findClient(Class<T> clientClass, Principal principal, VRObjectRepository db, org.springframework.http.HttpHeaders headers, Map<String,Object> attributes)
      Find an authorised known client, called only if security principal is known.
      Parameters:
      clientClass - class implementing the client, typically User
      principal - security principal of the client
      db - database repository
      headers - all HTTP headers
      attributes - session attributes copied from HttpSession
      Returns:
      a client found in the database or elsewhere
    • createGuestClient

      default <T extends Client> T createGuestClient(Class<T> clientClass, org.springframework.http.HttpHeaders headers, Map<String,Object> attributes)
      Create a new guest client, called only if server configuration allows for anonymous guest clients, and client name (security principal) is unknown. Default implementation does not create a client.
      Parameters:
      clientClass - class implementing the client, typically User
      headers - all HTTP headers
      attributes - session attributes copied from HttpSession
      Returns:
      new Client instance, null by default
    • handleUnknownClient

      default <T extends Client> T handleUnknownClient(Class<T> clientClass, org.springframework.http.HttpHeaders headers, Map<String,Object> attributes)
      Called if guest clients are not allowed, and user name (security principal) is unknown. Implementation may yet return a client based on headers available. Default implementation returns null.
      Parameters:
      clientClass - class implementing the client, typically User
      headers - all HTTP headers
      attributes - session attributes copied from HttpSession
      Returns:
      a Client determined by headers, null by default
    • clientNameAttribute

      default String clientNameAttribute()
      Identifies client attribute name, used as key to store client name in session attributes. Default is "local-user-name".
      Returns: