Example #1
0
        public IdentityPrincipal With(ApiKey apiKey)
        {
            Verify.IsNotEmpty(nameof(apiKey), apiKey);

            return(new IdentityPrincipal(PrincipalId, PrincipalType, apiKey, _properties));
        }
Example #2
0
        public IdentityPrincipal(PrincipalId clientId, IdentityPrincipalType principalType, ApiKey apiKey, IEnumerable <KeyValuePair <string, string> > properties)
        {
            Verify.IsNotEmpty(nameof(clientId), clientId);

            PrincipalId   = clientId;
            PrincipalType = principalType;
            ApiKey        = apiKey;

            properties  = properties ?? Enumerable.Empty <KeyValuePair <string, string> >();
            _properties = properties.ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase);
        }