Esri Geoportal Server
1.0

com.esri.gpt.framework.http
Class CredentialProvider

java.lang.Object
  extended by com.esri.gpt.framework.http.CredentialProvider

public class CredentialProvider
extends Object

Provides credentials for the execution of an HTTP client request.


Constructor Summary
CredentialProvider(String username, String password)
          Constructs with a supplied username and password.
 
Method Summary
static CredentialProvider establishThreadLocalInstance(HttpServletRequest request)
          Establishes a thread local instance of credentials based upon authorization credentials found within the HTTP request header.
 String getPassword()
          Gets the password.
static CredentialProvider getThreadLocalInstance()
          Gets the thread local instance of the credential provider.
 String getUsername()
          Gets the username.
 void setPassword(String password)
          Sets the password.
 void setUsername(String username)
          Sets the username.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CredentialProvider

public CredentialProvider(String username,
                          String password)
Constructs with a supplied username and password.

Parameters:
username - the username
password - the password
Method Detail

getThreadLocalInstance

public static CredentialProvider getThreadLocalInstance()
Gets the thread local instance of the credential provider.

Returns:
the thread local instance (can be null)

getPassword

public String getPassword()
Gets the password.

Returns:
the password

setPassword

public void setPassword(String password)
Sets the password.

Parameters:
password - the password

getUsername

public String getUsername()
Gets the username.

Returns:
the username

setUsername

public void setUsername(String username)
Sets the username.

Parameters:
username - the username

establishThreadLocalInstance

public static CredentialProvider establishThreadLocalInstance(HttpServletRequest request)
Establishes a thread local instance of credentials based upon authorization credentials found within the HTTP request header.

The general pattern is to challenge the UI client (browser) to provide credentials for accessing a remote server.

Parameters:
request - the executing HTTP servlet request
Returns:
the extablished thread local instance (null if authorization credentials were not found)

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.