Package org.astrogrid.samp.web

# Class WebCredentialPresenter

java.lang.Object
org.astrogrid.samp.web.WebCredentialPresenter

All Implemented Interfaces:
  `CredentialPresenter`

public class WebCredentialPresenter extends Object implements CredentialPresenter
CredentialPresenter for use with the Web Profile.

Uses the following securityMap items:

samp.name:
  Self-declared client name. Mandatory, but since it's supplied by the client, it doesn't tell you anything trustworthy.

and the following HTTP headers:

Origin:
  Application origin, present if CORS is in use. See Cross-Origin Resource Sharing, The Web Origin Concept (RFC 6454).
Referer:
  Connection URL, present at whim of browser. See HTTP/1.1 (RFC2616), sec 14.36.

The sole instance of this singleton class is `INSTANCE`.

Since:
  20 Jun 2016
Author:
  Mark Taylor

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.astrogrid.samp.web.CredentialPresenter

`CredentialPresenter.Presentation`

## Field Summary

Fields
Modifier and Type
Field
Description
`static final WebCredentialPresenter`
`INSTANCE`
Singleton instance.
`static final String`
`ORIGIN_HDR`
Origin header.
`static final String`
`REFERER_HDR`
Referer header.

## Method Summary

Modifier and Type
Method
Description
`CredentialPresenter.Presentation`
`createPresentation(HttpServer.Request request, Map securityMap, AuthResourceBundle.Content authContent)`
Returns an object which contains user-directed credential messages, given available information from the registration request.

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

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

## Field Details

### INSTANCE

public static final WebCredentialPresenter INSTANCE
Singleton instance.

### ORIGIN_HDR

public static final String ORIGIN_HDR
Origin header.

See Also:
  - Constant Field Values

### REFERER_HDR

public static final String REFERER_HDR
Referer header.

See Also:
  - Constant Field Values

## Method Details

### createPresentation

public CredentialPresenter.Presentation createPresentation(HttpServer.Request request, Map securityMap, AuthResourceBundle.Content authContent) throws SampException
Description copied from interface: `CredentialPresenter`
Returns an object which contains user-directed credential messages, given available information from the registration request. If the request or securityMap can be determined to be definitely unsuitable for registration, a SampException is thrown.

Specified by:
  `createPresentation` in interface `CredentialPresenter`
Parameters:
  `request` - HTTP request associated with the registration request
  `securityMap` - information explicitly supplied by the aspiring client in support of its application to register
  `authContent` - content of AuthResourceBundle bundle
Returns:
  items for presentation to the user
Throws:
  `SampException` - if credentials should definitely not be accepted