Skip to content

Commit a1333b1

Browse files
committed
Updated documentation for impersonation Authenticate
1 parent 94b6908 commit a1333b1

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/corelib/Providers/Rackspace/CloudIdentityProvider.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,28 @@ public UserAccess GetUserAccess(CloudIdentity identity, bool forceCacheRefresh =
701701
return userAccess;
702702
}
703703

704+
/// <summary>
705+
/// Gets the authentication token for the specified impersonation identity. If necessary, the
706+
/// identity is authenticated on the server to obtain a token.
707+
/// </summary>
708+
/// <remarks>
709+
/// If <paramref name="forceCacheRefresh"/> is <c>false</c> and a cached <see cref="IdentityToken"/>
710+
/// is available for the specified <paramref name="identity"/>, this method may return the cached
711+
/// value without performing an authentication against the server. If <paramref name="forceCacheRefresh"/>
712+
/// is <c>true</c>, this method always authenticates the identity with the server.
713+
/// </remarks>
714+
/// <param name="identity">The identity of the user to authenticate. If this value is <c>null</c>, the authentication is performed with the <see cref="DefaultIdentity"/>.</param>
715+
/// <param name="forceCacheRefresh">If <c>true</c>, the user is always authenticated against the server; otherwise a cached <see cref="IdentityToken"/> may be returned.</param>
716+
/// <returns>The user's authentication token.</returns>
717+
/// <exception cref="ArgumentNullException">If <paramref name="identity"/> is <c>null</c>.</exception>
718+
/// <exception cref="NotSupportedException">If the provider does not support the given <paramref name="identity"/> type.</exception>
719+
/// <exception cref="InvalidOperationException">If <paramref name="identity"/> is <c>null</c> and no default identity is available for the provider.</exception>
720+
/// <exception cref="ResponseException">If the authentication request failed.</exception>
704721
public UserAccess Authenticate(RackspaceImpersonationIdentity identity, bool forceCacheRefresh = false)
705722
{
723+
if (identity == null)
724+
throw new ArgumentNullException("identity");
725+
706726
var impToken = _userAccessCache.Get(string.Format("imp/{0}", identity.UserToImpersonate.Username), () => {
707727
const string urlPath = "/v2.0/RAX-AUTH/impersonation-tokens";
708728
var request = BuildImpersonationRequestJson(urlPath, identity.UserToImpersonate.Username, 600);

0 commit comments

Comments
 (0)