stdattrs

package
v0.0.0-...-122f59b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Sub is not used because we do not always use sub as the unique identifier for
	// an user from the identity provider.
	// Sub = "sub"
	Email               = "email"
	EmailVerified       = "email_verified"
	PhoneNumber         = "phone_number"
	PhoneNumberVerified = "phone_number_verified"
	PreferredUsername   = "preferred_username"
	FamilyName          = "family_name"
	GivenName           = "given_name"
	MiddleName          = "middle_name"
	Name                = "name"
	Nickname            = "nickname"
	Picture             = "picture"
	Profile             = "profile"
	Website             = "website"
	Gender              = "gender"
	Birthdate           = "birthdate"
	Zoneinfo            = "zoneinfo"
	Locale              = "locale"
	Address             = "address"
	Formatted           = "formatted"
	StreetAddress       = "street_address"
	Locality            = "locality"
	Region              = "region"
	PostalCode          = "postal_code"
	Country             = "country"
	UpdatedAt           = "updated_at"
)

Variables

View Source
var AccessControlViolated = apierrors.Forbidden.WithReason("AccessControlViolated")
View Source
var DependencySet = wire.NewSet(
	wire.Struct(new(Normalizer), "*"),
)
View Source
var SchemaBuilderAddress validation.SchemaBuilder
View Source
var SchemaBuilderAddressCountry = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderAddressFormatted = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderAddressLocality = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderAddressPostalCode = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderAddressRegion = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderAddressStreetAddress = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderBirthdate = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	Format("birthdate")
View Source
var SchemaBuilderEmail = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	Format("email")
View Source
var SchemaBuilderFamilyName = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderGender = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderGivenName = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderLocale = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	Format("bcp47")
View Source
var SchemaBuilderMiddleName = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderName = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderNickName = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderPhoneNumber = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	Format("phone")
View Source
var SchemaBuilderPicture = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	Format("x_picture")
View Source
var SchemaBuilderPreferredUsername = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	MinLength(1)
View Source
var SchemaBuilderProfile = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	Format("uri")
View Source
var SchemaBuilderWebsite = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	Format("uri")
View Source
var SchemaBuilderZoneinfo = validation.SchemaBuilder{}.
	Type(validation.TypeString).
	Format("timezone")
View Source
var StandardAttributesEmailRequired = apierrors.BadRequest.WithReason("StandardAttributesEmailRequired")

Functions

func SchemaBuilderForPointerString

func SchemaBuilderForPointerString(ptrStr string) (validation.SchemaBuilder, bool)

func Validate

func Validate(t T) error

Types

type ExtractOptions

type ExtractOptions struct {
	EmailRequired bool
}

type LoginIDNormalizerFactory

type LoginIDNormalizerFactory interface {
	NormalizerWithLoginIDType(loginIDKeyType model.LoginIDKeyType) loginid.Normalizer
}

type Normalizer

type Normalizer struct {
	LoginIDNormalizerFactory LoginIDNormalizerFactory
}

func (*Normalizer) Normalize

func (n *Normalizer) Normalize(t T) error

type T

type T map[string]interface{}

func Extract

func Extract(claims map[string]interface{}, opts ExtractOptions) (T, error)

Extract extracts OIDC standard claims. The output is NOT normalized.

func (T) CheckWrite

func (t T) CheckWrite(accessControl accesscontrol.T, role accesscontrol.Role, that T) error

func (T) Clone

func (t T) Clone() T

func (T) FormattedName

func (t T) FormattedName() string

func (T) FormattedNames

func (t T) FormattedNames() string

func (T) MergedWith

func (t T) MergedWith(that T) T

MergedWith returns a T with that merged into t.

func (T) MergedWithForm

func (t T) MergedWithForm(ptrs map[string]string) (T, error)

func (T) MergedWithList

func (t T) MergedWithList(l attrs.List) (T, error)

func (T) NonIdentityAware

func (t T) NonIdentityAware() T

NonIdentityAware returns a copy of t with identity-aware attributes removed.

func (T) ReadWithAccessControl

func (t T) ReadWithAccessControl(accessControl accesscontrol.T, role accesscontrol.Role) T

func (T) Tidy

func (t T) Tidy() T

func (T) ToClaims

func (t T) ToClaims() map[string]interface{}

func (T) WithDerivedAttributesRemoved

func (t T) WithDerivedAttributesRemoved() T

func (T) WithNameCopiedToGivenName

func (t T) WithNameCopiedToGivenName() T

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL