Added support for the Validate AuthToken Service.
Made necessary spec file changes to support our configuration.
This commit is contained in:
@@ -135,14 +135,27 @@ public class AuthToken
|
||||
* Constructor given an authentication token string. The constructor
|
||||
* validates the token as part of its processing.
|
||||
*/
|
||||
public AuthToken(String token) throws Exception
|
||||
public AuthToken(String token,
|
||||
boolean encodedToken) throws Exception
|
||||
{
|
||||
// Decode the token string
|
||||
m_token = Base64Coder.decode(token);
|
||||
// Decode the token string if necessary
|
||||
if (encodedToken)
|
||||
m_token = Base64Coder.decode(token);
|
||||
else
|
||||
m_token = token;
|
||||
|
||||
// Now instantiate a SOAP message with the string
|
||||
InputStream inStream = new ByteArrayInputStream(m_token.getBytes());
|
||||
Message message = new Message(inStream);
|
||||
org.apache.axis.Message message;
|
||||
try
|
||||
{
|
||||
message = new Message(inStream);
|
||||
|
||||
} catch (Exception e)
|
||||
{
|
||||
System.err.println("AuthToken()- Exception caught creating message, msg: " + e.getMessage());
|
||||
throw new Exception("Invalid Authentication Token");
|
||||
}
|
||||
|
||||
// Get access to the SOAP Envelope
|
||||
SOAPEnvelope envelope = message.getSOAPEnvelope();
|
||||
@@ -284,16 +297,20 @@ public class AuthToken
|
||||
* Validates an authentication token. If successful it
|
||||
* returns a string containing the identity token associated
|
||||
* with the authentication token; otherwise it returns NULL;
|
||||
*
|
||||
* Note, the routine assumes that the token is not encoded.
|
||||
*/
|
||||
public static String validate(String authTokenString)
|
||||
{
|
||||
System.err.println("AuthToken.validate()- Start");
|
||||
// Instantiate the AuthToken, this validates the token itself.
|
||||
try
|
||||
{
|
||||
AuthToken authToken = new AuthToken(authTokenString);
|
||||
AuthToken authToken = new AuthToken(authTokenString, false);
|
||||
|
||||
// If we are here is because the token validation succeeded,
|
||||
// return the identity token string.
|
||||
System.err.println("AuthToken.validate()- Returning identity token");
|
||||
return authToken.getIdentityToken();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user