protected IdCard(string version, XElement xAssertion, string cardId, AuthenticationLevel authLevel, string certHash, string issuer, DateTime creationDate, DateTime expiryDate, string alternativeIdentifier, string username, string password) { ModelUtilities.ValidateNotNull(cardId, "IDCard ID cannot be 'null'"); ModelUtilities.ValidateNotEmpty(issuer, "'Issuer' cannot be null or empty"); ModelUtilities.ValidateNotNull(authLevel, "'AuthenticationLevel' cannot be null"); this.Version = version; this.CreatedDate = creationDate; this.ExpiryDate = expiryDate; this.Issuer = issuer; this.AuthenticationLevel = authLevel; if (AuthenticationLevel.MocesTrustedUser.Equals(authLevel) || AuthenticationLevel.VocesTrustedSystem.Equals(authLevel)) { this.CertHash = certHash; } this.Xassertion = xAssertion; this.AlternativeIdentifier = alternativeIdentifier; if (AuthenticationLevel.UsernamePasswordAuthentication.Equals(authLevel)) { ModelUtilities.ValidateNotEmpty(username, "'username' cannot be null or empty for authenticationlevel 2"); ModelUtilities.ValidateNotEmpty(password, "'password' cannot be null or empty for authenticationlevel 2"); this.Username = username; this.Password = password; } // This is an invariant! When the IDCard is created from deserialization, // the ID card is already signed => needsSignature=false NeedsSignature = (xAssertion == null); IdCardId = cardId; }
protected IdCard(string version, XElement domElement, string cardId, AuthenticationLevel authenticationLevel, string issuer, SystemInfo systemInfo, string certHash, string alternativeIdentifier, string userName, string password) { ModelUtilities.ValidateNotEmpty(issuer, "'Issuer' cannot be null or empty"); ModelUtilities.ValidateNotNull(authenticationLevel, "'AuthenticationLevel' cannot be null"); Version = version; CreatedDate = DateTime.Now.AddMinutes(-IDCARD_BEGIN_TIME_BUFFER_IN_MINUTES); ExpiryDate = CreatedDate.AddHours(MAX_IDCARD_LIFE_IN_HOURS); Issuer = issuer; AuthenticationLevel = authenticationLevel; if (AuthenticationLevel.MocesTrustedUser.Equals(authenticationLevel) || AuthenticationLevel.VocesTrustedSystem.Equals(authenticationLevel)) { CertHash = certHash ?? ""; } AlternativeIdentifier = alternativeIdentifier; if (AuthenticationLevel.UsernamePasswordAuthentication.Equals(authenticationLevel)) { ModelUtilities.ValidateNotEmpty(userName, "'username' cannot be null or empty for authenticationlevel 2"); ModelUtilities.ValidateNotEmpty(password, "'password' cannot be null or empty for authenticationlevel 2"); Username = userName; Password = password; } Xassertion = domElement; NeedsSignature = (Xassertion == null); IdCardId = cardId; }
public SystemIdCard(string version, XElement xAssertion, string cardId, AuthenticationLevel authLevel, string certHash, string issuer, SystemInfo systemInfo, DateTime creationDate, DateTime expiryDate, string alternativeIdentifier, string username, string password) : base(version, xAssertion, cardId, authLevel, certHash, issuer, creationDate, expiryDate, alternativeIdentifier, username, password) { ModelUtilities.ValidateNotNull(systemInfo, "SystemInfo must be specified"); ModelUtilities.ValidateNotNull(systemInfo.CareProvider, "SystemInfo must be specified"); this.SystemInfo = systemInfo; }
public SystemIdCard(string version, AuthenticationLevel authLevel, string issuer, SystemInfo systemInfo, string certHash, string alternativeIdentifier, string userName, string password) : base(version, authLevel, issuer, certHash, alternativeIdentifier, userName, password) { ModelUtilities.ValidateNotEmpty(systemInfo.ItSystemName, "SystemInfo must be specified"); ModelUtilities.ValidateNotNull(systemInfo.CareProvider, "SystemInfo must be specified"); SystemInfo = systemInfo; }
public UserIdCard(string version, AuthenticationLevel authLevel, string issuer, SystemInfo systemInfo, UserInfo userInfo, string certHash, string alternativeIdentifier, string userName, string password) : base(version, authLevel, issuer, systemInfo, certHash, alternativeIdentifier, userName, password) { ModelUtilities.ValidateNotNull(userInfo, "UserInfo must be specified"); UserInfo = userInfo; }