Package org.astrogrid.samp.web

# Class ClientAuthorizers

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

public class ClientAuthorizers extends Object
Utility class containing ClientAuthorizer implementations.

Since:
  2 Feb 2011
Author:
  Mark Taylor

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ClientAuthorizer`
`FALSE`
Authorizer which always denies access, with INFO logging either way.
`static final ClientAuthorizer`
`TRUE`
Authorizer which always permits access, with WARNING logging either way.

## Method Summary

Modifier and Type
Method
Description
`static ClientAuthorizer`
`createFixedClientAuthorizer(boolean policy)`
Returns a new authorizer instance which always produces the same authorization status.
`static ClientAuthorizer`
`createLoggingClientAuthorizer(ClientAuthorizer auth, Level acceptLevel, Level refuseLevel)`
Returns a new authorizer instance based on an existing one which logs authorization results through the logging system.
`static String`
`getAppName(Map securityMap)`
Returns the mandatory application name entry from the security map supplied explicitly by clients wishing to register.

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

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

## Field Details

### FALSE

public static final ClientAuthorizer FALSE
Authorizer which always denies access, with INFO logging either way.

### TRUE

public static final ClientAuthorizer TRUE
Authorizer which always permits access, with WARNING logging either way.

## Method Details

### createFixedClientAuthorizer

public static ClientAuthorizer createFixedClientAuthorizer(boolean policy)
Returns a new authorizer instance which always produces the same authorization status.

Parameters:
  `policy` - true for accept, false for deny
Returns:
  new authorizer

### createLoggingClientAuthorizer

public static ClientAuthorizer createLoggingClientAuthorizer(ClientAuthorizer auth, Level acceptLevel, Level refuseLevel)
Returns a new authorizer instance based on an existing one which logs authorization results through the logging system.

Parameters:
  `auth` - base authorizer
  `acceptLevel` - logging level at which auth acceptances are logged
  `refuseLevel` - logging level at which auth refusals are logged
Returns:
  new authorizer

### getAppName

public static String getAppName(Map securityMap) throws SampException
Returns the mandatory application name entry from the security map supplied explicitly by clients wishing to register. The relevant key is "samp.name" (Metadata.NAME_KEY). If it's not present and correct, a SampException is thrown indicating that registration is rejected.

Parameters:
  `securityMap` - map supplied by client
Returns:
  value of samp.name key, not null
Throws:
  `SampException` - if name not present