info.sswap.ontologies.data.impl
Class HTTPBasicAuthImpl
java.lang.Object
info.sswap.ontologies.data.impl.AbstractData
info.sswap.ontologies.data.impl.ResourceData
info.sswap.ontologies.data.impl.HTTPBasicAuthImpl
- All Implemented Interfaces:
- Accessor, Data, Parser, Serializer, Validator
public class HTTPBasicAuthImpl
- extends ResourceData
Implementation of support for HTTP Authentication for resource data
- Author:
- Damian Gessler
Field Summary |
private java.lang.String |
passwd
|
private java.lang.String |
username
|
Constructor Summary |
HTTPBasicAuthImpl(SSWAPIndividual sswapIndividual,
java.lang.String username,
java.lang.String passwd)
Construct HTTP Authentication access. |
Method Summary |
java.net.URLConnection |
access(java.net.URLConnection urlConnection)
If the individual has a data:hasAccessor property value
equal to the value of HTTPBasicAuthenticationAccessor.uri ,
then a HTTP Basic Authentication connection is opened. |
java.lang.String |
getPasswd()
The password for the username |
java.lang.String |
getUsername()
The username for authentication |
void |
setUsernamePasswd(java.lang.String username,
java.lang.String passwd)
Set the username and password; replaces username and password as set with the constructor. |
Methods inherited from class info.sswap.ontologies.data.impl.AbstractData |
getAccessors, getFormats, getIndividual, getParsers, getSerializers, getValidators, hasValue, inputStreamToString, parse, serialize, setValue, stringToInputStream, validate |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
username
private java.lang.String username
passwd
private java.lang.String passwd
HTTPBasicAuthImpl
public HTTPBasicAuthImpl(SSWAPIndividual sswapIndividual,
java.lang.String username,
java.lang.String passwd)
throws DataAccessException
- Construct HTTP Authentication access.
- Parameters:
sswapIndividual
- the resource data to be read/written requiring HTTP Basic Authenticationusername
- username to be authenticatedpasswd
- password for the username
- Throws:
DataAccessException
- on any error establishing access
access
public java.net.URLConnection access(java.net.URLConnection urlConnection)
throws java.io.IOException,
AccessorException
- If the individual has a
data:hasAccessor
property value
equal to the value of HTTPBasicAuthenticationAccessor.uri
,
then a HTTP Basic Authentication connection is opened. Otherwise, a
regular connection is opened.
- Specified by:
access
in interface Accessor
- Overrides:
access
in class ResourceData
- Parameters:
urlConnection
- a URL connection opened on the data element individual (the
individual itself or one of its Accessors)
- Returns:
- URLConnection an open URL connection
- Throws:
java.io.IOException
- on network error
AccessorException
- on access error- See Also:
HTTPBasicAuthenticationAccessor
getUsername
public java.lang.String getUsername()
- The username for authentication
- Returns:
- the username
setUsernamePasswd
public void setUsernamePasswd(java.lang.String username,
java.lang.String passwd)
- Set the username and password; replaces username and password as set with the constructor.
- Parameters:
username
- username to be authenticatedpasswd
- password for username
getPasswd
public java.lang.String getPasswd()
- The password for the username
- Returns:
- the password
Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.