|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.extensions.webscripts.connector.AuthenticatingConnector
public class AuthenticatingConnector
A special implementation of an Authenticating Connector. The AuthenticatingConnector is a wrapper around a Connector object and an Authenticator object. It appears as a Connector to the outside world but provides additional functionality. When a call is made, the underlying connector is used to call over to the resource. The underlying connector retrieves cookie state from the connector session (if available) and attempts to access the remote resource. If this succeeds, then the AuthenticatingConnector returns this response. On the other hand, if this fails (i.e. it receives a 401 unauthorized response), the AuthenticatingConnector calls into the underlying Authenticator instance to perform an "authentication handshake". This handshake retrieves the necessary cookies or tokens and places them into the connector session. The connector session is persisted to the session (if it was originally bound to the session). The AuthenticatingConnector then reattempts the connection using the newly retrieved cookies or tokens. If a 401 is received again, the credentials are assumed to be invalid (or something is incorrect about the handshake model).
Field Summary | |
---|---|
protected Authenticator |
authenticator
|
protected Connector |
connector
|
protected static org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
---|---|
AuthenticatingConnector(Connector connector,
Authenticator authenticator)
Instantiates a new authenticating connector. |
Method Summary | |
---|---|
Response |
call(String uri)
Invokes a URI on a remote service. |
Response |
call(String uri,
ConnectorContext context)
Invokes a URI on a remote service. |
Response |
call(String uri,
ConnectorContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Invokes a URI on a remote service and streams back results to the provided response object. |
Response |
call(String uri,
ConnectorContext context,
InputStream in)
Invokes a URI on a remote service, passing the input as supplied via a POST/PUT. |
Response |
call(String uri,
ConnectorContext context,
InputStream in,
OutputStream out)
Invokes a URI on a remote service. |
ConnectorSession |
getConnectorSession()
Returns the connector session |
Credentials |
getCredentials()
Returns the credents for this connector. |
String |
getEndpoint()
Returns the endpoint to which this connector connects. |
boolean |
handshake()
Performs the authentication handshake. |
protected boolean |
isAuthenticated()
Returns whether the current session is authenticated already. |
void |
setConnectorSession(ConnectorSession connectorSession)
Sets the connector session |
void |
setCredentials(Credentials credentials)
Binds Credentials to this connector. |
void |
setEndpoint(String endpoint)
Sets the endpoint. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static org.apache.commons.logging.Log logger
protected Connector connector
protected Authenticator authenticator
Constructor Detail |
---|
public AuthenticatingConnector(Connector connector, Authenticator authenticator)
connector
- the connectorauthenticator
- the authenticatorMethod Detail |
---|
public Response call(String uri)
Connector
call
in interface Connector
uri
- the uri
public Response call(String uri, ConnectorContext context)
Connector
call
in interface Connector
uri
- the uricontext
- the context of the invoke
public Response call(String uri, ConnectorContext context, InputStream in)
Connector
call
in interface Connector
uri
- the uricontext
- the context of the invokein
- the input stream
public Response call(String uri, ConnectorContext context, InputStream in, OutputStream out)
Connector
call
in interface Connector
uri
- the uricontext
- the context of the invokein
- the input streamout
- the output stream
public Response call(String uri, ConnectorContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
Connector
call
in interface Connector
uri
- the uricontext
- the context of the invokereq
- Request to proxy fromres
- Response to proxy onto
public void setCredentials(Credentials credentials)
Connector
setCredentials
in interface Connector
credentials
- the new credentialspublic Credentials getCredentials()
Connector
getCredentials
in interface Connector
public void setEndpoint(String endpoint)
Connector
setEndpoint
in interface Connector
endpoint
- the new endpointpublic String getEndpoint()
Connector
getEndpoint
in interface Connector
public void setConnectorSession(ConnectorSession connectorSession)
Connector
setConnectorSession
in interface Connector
public ConnectorSession getConnectorSession()
Connector
getConnectorSession
in interface Connector
protected boolean isAuthenticated()
public final boolean handshake()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |