2.5.3.1.6 LookupAttributeInToken

msdn link

A support function, LookupAttributeInToken, locates an attribute in the token based on the AttributeName passed in, if one is present. If one is not present then NULL is returned.

 CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 
 LookupAttributeInToken (
     WCHAR AttributeName,
     TOKEN Token,
     BYTE Source
      )
     --
     -- On entry
     --    AttributeName is the Unicode string attribute.
     --    Token is the Authz context or NT Token representing the user
     --    Source indicates which section of the token to look for the attributes.
  
     Dim CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 LookupList[]
  
     IF Source is equal to 0xf8 THEN
         Set LookupList to Token.LocalClaims
     ENDIF
  
  
     IF Source is equal to 0xf9 THEN
         Set LookupList to Token.UserClaims
     ENDIF
  
     IF Source is equal to 0xfb THEN
         Set LookupList to Token.DeviceClaims
     ENDIF
  
     FOR EACH Attribute in LookupList DO
         IF Attribute.Name equals AttributeName THEN
             Return Attribute
         END IF
     END FOR
  
     Return NULL
  
 END-SUBROUTINE