Documentation
¶
Index ¶
- Constants
- func NormalizeContactPrincipal(contactType, contactPrincipal string) string
- func ValidateApp(includeID bool, app App) errors.RichError
- func ValidateScope(includeID bool, scope Scope) errors.RichError
- type Address
- type App
- type AuditLog
- type Contact
- type LogLevel
- type Profile
- type Scope
- type Token
- type TokenType
- type User
Constants ¶
const ( AssetType_User = "user" AssetType_Application = "application" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Address ¶
type Address struct {
ID string `bson:"-"`
UserID string `bson:"-"`
Name nullable.NullableString `bson:"name"`
Line1 string `bson:"line1"`
Line2 nullable.NullableString `bson:"line2"`
City string `bson:"city"`
State string `bson:"state"`
PostalCode string `bson:"postalCode"`
IsPrimary bool `bson:"isPrimary"`
// contains filtered or unexported fields
}
TODO: Add validator for pre insert / update Address is a physical address.
func NewAddress ¶
type App ¶
type App struct {
ID string `bson:"-"`
OwnerID string `bson:"-"`
Name string `bson:"name"`
ClientID string `bson:"clientId"`
ClientSecretHash string `bson:"clientSecret"`
CallbackURI string `bson:"callbackUri"`
IsDisabled bool `bson:"isDisabled"`
LogoURI string `bson:"logoUri"`
AuditData auditable `bson:",inline"`
}
type Contact ¶
type Contact struct {
ID string `bson:"-"`
UserID string `bson:"-"`
Name nullable.NullableString `bson:"name"`
RawPrincipal string `bson:"rawPrincipal"`
Principal string `bson:"principal"`
Type string `bson:"type"`
IsPrimary bool `bson:"isPrimary"`
// ConfirmationCode nullable.NullableString `bson:"confirmationCode"`
ConfirmedDate nullable.NullableTime `bson:"confirmedDate"`
AuditData auditable `bson:",inline"`
}
TODO: Add validator for pre insert / update TODO: determine if the confirmation code needs an expiration date? or use redis for these short lived tokens? Contact is a model that represents a contact method for a user like phone or email.
func NewContact ¶
TODO: write unit tests
func (*Contact) IsConfirmed ¶
type Profile ¶
type Profile struct {
ID string `bson:"-"`
UserID string `bson:"-"`
FirstName nullable.NullableString `bson:"firstName"`
MiddleName nullable.NullableString `bson:"middleName"`
LastName nullable.NullableString `bson:"lastName"`
DateOfBirth nullable.NullableTime `bson:"dateOfBirth"`
// contains filtered or unexported fields
}
TODO: Add validator for pre insert / update Profile represents personal profile data for a given user.
type Scope ¶
type Token ¶
type Token struct {
// Value needs to a be a universially unique value like a uuid or something like that. This is the token passed around.
Value string
// TokenType is the type of token the token is.
TokenType TokenType
// Expiration is the time at which the token expires. all tokens must expire, so this must have a value.
Expiration time.Time
// TargetID is to specify the entity to who the token applies. if the token can be accessed anonymously, leave this blank.
TargetID string
// MetaData is a map that contains general purpose data related to a token.
MetaData map[string]string
}
Token is a temporary item that can be used as a shared secret like a password reset token or a confirm contact token. They can be tide to a target entity like a user to ensure they are consumed by the proper targets.
func (*Token) AddMetaData ¶
func (*Token) WithMetaData ¶
type User ¶
type User struct {
ID string `bson:"-"`
PasswordHash string `bson:"passwordHash"`
ConsecutiveFailedLoginAttempts int `bson:"consecutiveFailedLoginAttempts"`
LockedOutUntil nullable.NullableTime `bson:"lockedOutUntil"`
LastLoginDate nullable.NullableTime `bson:"lastLoginDate"`
// PasswordResetToken nullable.NullableString `bson:"passwordResetToken"`
// PasswordResetTokenExpiration nullable.NullableTime `bson:"passwordResetTokenExpiration"`
AuditData auditable `bson:",inline"`
}
TODO: Add validator for pre insert / update User represents a user in the system.