Package org.vrspace.server.core
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.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
Identifies client attribute name, used as key to store client name in session attributes.default <T extends Client>
TcreateGuestClient
(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>
TfindClient
(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>
ThandleUnknownClient
(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
-
CLIENT_NAME_ATTRIBUTE
- See Also:
-
CLIENT_ID_ATTRIBUTE
- See Also:
-
-
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 Userprincipal
- security principal of the clientdb
- database repositoryheaders
- all HTTP headersattributes
- 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 Userheaders
- all HTTP headersattributes
- 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 Userheaders
- all HTTP headersattributes
- session attributes copied from HttpSession- Returns:
- a Client determined by headers, null by default
-
clientNameAttribute
Identifies client attribute name, used as key to store client name in session attributes. Default is "local-user-name".- Returns:
-