com.microsoft.tfs.core.clients.webservices
Class IdentityHelper

java.lang.Object
  extended by com.microsoft.tfs.core.clients.webservices.IdentityHelper

public class IdentityHelper
extends java.lang.Object

Helper class to manage Team Foundation identity descriptors.

Since:
TEE-SDK-10.1
Thread-safety:
thread-compatible

Constructor Summary
IdentityHelper()
           
 
Method Summary
static void checkDescriptor(IdentityDescriptor descriptor, java.lang.String parameterName)
           
static IdentityDescriptor createDescriptorFromSID(java.lang.String sid)
          Create TFS or Windows descriptor for SID based identities.
static java.lang.String createSecurityToken(TeamFoundationIdentity group)
          Security token for an identity that we own (TFS group).
static IdentityDescriptor createTeamFoundationDescriptor(java.lang.String sid)
          Create descriptor with identity type of TeamFoundation.
static IdentityDescriptor createWindowsDescriptor(java.lang.String sid)
          Create descriptor with identity type of Windows.
static java.lang.String getDomainUserName(TeamFoundationIdentity identity)
          Get identity name for display.
static java.lang.String getUniqueNameIfCurrentUser(TeamFoundationIdentity identity, java.lang.String userName)
          Returns a unique user name if the specified user name matches any of the various formats of the current authorized user.
static boolean identityHasName(TeamFoundationIdentity identity, java.lang.String name)
          Returns true if the specified name matches any format of the specified identity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IdentityHelper

public IdentityHelper()
Method Detail

createDescriptorFromSID

public static IdentityDescriptor createDescriptorFromSID(java.lang.String sid)
Create TFS or Windows descriptor for SID based identities. If the type is already known, using the type specific Create method will be faster. TFS sids start with S-1-9-1551374245. Anything else is treated as Windows. Known forms of Windows SIDs are S-1-5-xxxx, well known sids of the form S-1-0, S-1-0-xx, S-1-2, S-1-3, S-1-3-xx, S-1-4, S-1-5, S-1-5-xxx


createWindowsDescriptor

public static IdentityDescriptor createWindowsDescriptor(java.lang.String sid)
Create descriptor with identity type of Windows. Note - this does not validate that the SID really is a Windows SID. But if that is not the case, failure will occur later when this descriptor is used in IMS APIs.


createTeamFoundationDescriptor

public static IdentityDescriptor createTeamFoundationDescriptor(java.lang.String sid)
Create descriptor with identity type of TeamFoundation. Note - this does not validate that the SID really is a TeamFoundation SID. But if that is not the case, failure will occur later when this descriptor is used in IMS APIs.


identityHasName

public static boolean identityHasName(TeamFoundationIdentity identity,
                                      java.lang.String name)
Returns true if the specified name matches any format of the specified identity.


getUniqueNameIfCurrentUser

public static java.lang.String getUniqueNameIfCurrentUser(TeamFoundationIdentity identity,
                                                          java.lang.String userName)
Returns a unique user name if the specified user name matches any of the various formats of the current authorized user.

Parameters:
identity - The current authorized user identity from the TfsServer.
userName - The user name to match.
Returns:
A unique user name if the user name matches the current authorized identity. Otherwise, the input user name is returned.

getDomainUserName

public static java.lang.String getDomainUserName(TeamFoundationIdentity identity)
Get identity name for display.


createSecurityToken

public static java.lang.String createSecurityToken(TeamFoundationIdentity group)
Security token for an identity that we own (TFS group).


checkDescriptor

public static void checkDescriptor(IdentityDescriptor descriptor,
                                   java.lang.String parameterName)


© 2015 Microsoft. All rights reserved.