Beispiel #1
0
 public GangUserData SetLinkCode(
     GangUserLinkCode value)
 {
     return(new GangUserData(
                Id,
                Name, Email,
                Roles,
                Secret,
                value, Challenge,
                Credentials
                ));
 }
Beispiel #2
0
        public GangUserLink GetLink(GangUserLinkCode code, object data = null)
        {
            if (code.Value == null ||
                code.Expires == null ||
                code.Expires < DateTimeOffset.Now)
            {
                throw new InvalidOperationException("Link code is invalid");
            }

            return(new GangUserLink(
                       Name, Email,
                       code, data
                       ));
        }
Beispiel #3
0
 public GangUserData(
     string id,
     string name = "(new user)", string email = null,
     IEnumerable <string> roles = null,
     string secret             = null,
     GangUserLinkCode linkCode = null, string challenge = null,
     IEnumerable <GangUserCredential> credentials = null
     )
 {
     Id    = id;
     Name  = name;
     Email = email;
     Roles = roles?.ToImmutableSortedSet()
             ?? ImmutableSortedSet <string> .Empty;
     Secret      = secret ?? $"{Guid.NewGuid():N}";
     LinkCode    = linkCode;
     Challenge   = challenge;
     Credentials = credentials.ToImmutableListDefaultEmpty();
 }