Skip to content

Instantly share code, notes, and snippets.

@miceiken
Created July 3, 2019 12:38
Show Gist options
  • Save miceiken/8b8b06a66ea646e84dc29360f4fcb16f to your computer and use it in GitHub Desktop.
Save miceiken/8b8b06a66ea646e84dc29360f4fcb16f to your computer and use it in GitHub Desktop.
using System;
namespace Identity.Models
{
public enum CredentialType
{
Password,
PublicKey,
Token,
};
public abstract class Credential
{
protected Credential(CredentialType credentialType)
{
CredentialType = credentialType;
}
public CredentialType CredentialType { get; set; }
public DateTime CreationTime { get; set; }
}
public class PasswordCredential : Credential
{
public PasswordCredential(byte[] salt, byte[] key)
: base(CredentialType.Password)
{
Salt = salt;
Key = key;
}
public byte[] Salt { get; set; }
public byte[] Key { get; set; }
}
public class PublicKeyCredential : Credential
{
public PublicKeyCredential(byte[] publicKey)
: base(CredentialType.PublicKey)
{
PublicKey = publicKey;
}
public byte[] PublicKey { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment