com.microsoft.tfs.core.util
Class FederatedAuthenticationHelpers

java.lang.Object
  extended by com.microsoft.tfs.core.util.FederatedAuthenticationHelpers

public class FederatedAuthenticationHelpers
extends java.lang.Object


Field Summary
static org.apache.commons.logging.Log log
           
 
Constructor Summary
FederatedAuthenticationHelpers()
           
 
Method Summary
protected static java.lang.String getDetailMessage(java.lang.String acsResponseBody)
          Parses the detail message "ACS50012: Authentication failed.
static java.lang.String getWRAPAccessToken(HTTPClientFactory clientFactory, java.net.URI acsIssuerURI, java.lang.String wrapScope, java.lang.String wrapName, java.lang.String wrapPassword)
          Gets a WRAP access token from the specified ACS URI (the scheme, host, and port are used; path is replaced with WRAP document path).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.apache.commons.logging.Log log
Constructor Detail

FederatedAuthenticationHelpers

public FederatedAuthenticationHelpers()
Method Detail

getWRAPAccessToken

public static java.lang.String getWRAPAccessToken(HTTPClientFactory clientFactory,
                                                  java.net.URI acsIssuerURI,
                                                  java.lang.String wrapScope,
                                                  java.lang.String wrapName,
                                                  java.lang.String wrapPassword)
                                           throws ACSUnauthorizedException,
                                                  HTTPProxyUnauthorizedException
Gets a WRAP access token from the specified ACS URI (the scheme, host, and port are used; path is replaced with WRAP document path).

See http://msdn.microsoft.com/en-us/library/ee706734.aspx for WRAP protocol specifics including restrictions on scope, name, and password values.

Parameters:
clientFactory - an HttpClient factory (must not be null)
acsIssuerURI - the URI to the Azure ACS authentication issuer (must not be null)
wrapScope - the plaintext WRAP scope, not URL-encoded (must not be null or empty)
wrapName - the plaintext WRAP username, not URL-encoded (must not be null or empty)
wrapPassword - the plaintext WRAP password, not BASE-64 encoded (must not be null)
Returns:
the WRAP access token, or null if it could not be retrieved because of a protocol or network error
Throws:
ACSUnauthorizedException - if the WRAP token could not be retrieved because of an authorization problem to ACS
HTTPProxyUnauthorizedException - if an HTTP proxy denied the request for authorization reasons

getDetailMessage

protected static java.lang.String getDetailMessage(java.lang.String acsResponseBody)
Parses the detail message "ACS50012: Authentication failed. " from an ACS error response body like:
 Error:Code:403:SubCode:T0:Detail:ACS50012: Authentication failed. :TraceID:556a1fc6-3f3f-46f4-88ec-f8e865e6eca4:TimeStamp:2011-04-13 21:17:28Z
 

Returns:
the (probably always English) detail code, or null if it was not found in the body


© 2015 Microsoft. All rights reserved.