models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProcess

type AuthProcess struct {
	Code                  string           `json:"code"`
	ClientID              string           `json:"client_id"`
	RedirectURI           string           `json:"redirect_uri"`
	State                 string           `json:"state"`
	Nonce                 string           `json:"nonce"`
	Scopes                []string         `json:"scopes"`
	CreatedAt             time.Time        `json:"created_at"`
	ExpiresAt             time.Time        `json:"expires_at"`
	CertificateData       *CertificateData `json:"certificate_data,omitempty"`
	Powers                string           `json:"powers,omitempty"`
	SignedAnnex           string           `json:"signed_annex,omitempty"`
	Email                 string           `json:"email,omitempty"`
	EmailVerificationCode string           `json:"email_verification_code,omitempty"`
	EmailVerified         bool             `json:"email_verified,omitempty"`
	ConsentGiven          bool             `json:"consent_given,omitempty"`
	WalletAuthRequest     string           `json:"wallet_auth_request,omitempty"`
	CredentialData        map[string]any   `json:"credential_data,omitempty"`
	FinishedWalletAuth    bool             `json:"finished_wallet_auth,omitempty"`
	ErrorInProcess        error            `json:"-"`
}

AuthProcess holds the info during the whole application authorization process for a given RP

type AuthorizationRequest

type AuthorizationRequest struct {
	ResponseType string `json:"response_type"`
	ClientID     string `json:"client_id"`
	RedirectURI  string `json:"redirect_uri"`
	// Scope        string `json:"scope"`
	Scopes    []string
	State     string `json:"state"`
	Nonce     string `json:"nonce,omitempty"`
	CreatedAt time.Time
}

AuthorizationRequest represents an OAuth2 authorization request sent from the RP

type CertificateData

type CertificateData struct {
	EIDASCertificate bool               `json:"eidas_certificate"`
	OrganizationID   string             `json:"organization_identifier"`
	Subject          *x509util.ELSIName `json:"subject"` // Already processed from Certificate for convenience
	Issuer           *x509util.ELSIName `json:"issuer"`  // Already processed from Certificate for convenience
	ValidFrom        time.Time          `json:"valid_from"`
	ValidTo          time.Time          `json:"valid_to"`
	CertificateType  string             `json:"certificate_type"` // "organizational" or "personal"
	Certificate      *x509.Certificate  `json:"certificate"`
	CertificateDER   string             `json:"certificate_der"`
}

CertificateData represents certificate information for exchange between services

type ContractForm

type ContractForm struct {
	TodayDay             int    `form:"today_day" json:"today_day"`
	TodayMonth           int    `form:"today_month" json:"today_month"`
	TodayYear            int    `form:"today_year" json:"today_year"`
	OrganizationName     string `form:"organization_name" json:"organization_name"`
	OrganizationCountry  string `form:"organization_country" json:"organization_country"`
	OrganizationAddress  string `form:"organization_address" json:"organization_address"`
	OrganizationNif      string `form:"organization_nif" json:"organization_nif"`
	RegistryName         string `form:"registry_name" json:"registry_name"`
	RegistryVolume       string `form:"registry_volume" json:"registry_volume"`
	RegistryFolio        string `form:"registry_folio" json:"registry_folio"`
	RegistrySheet        string `form:"registry_sheet" json:"registry_sheet"`
	RepresentativeTitle  string `form:"representative_title" json:"representative_title"`
	RepresentativeName   string `form:"representative_name" json:"representative_name"`
	RepresentativeEmail  string `form:"representative_email" json:"representative_email"`
	NotaryCity           string `form:"notary_city" json:"notary_city"`
	NotaryTitle          string `form:"notary_title" json:"notary_title"`
	NotaryName           string `form:"notary_name" json:"notary_name"`
	NotaryDay            string `form:"notary_day" json:"notary_day"`
	NotaryMonth          string `form:"notary_month" json:"notary_month"`
	NotaryYear           string `form:"notary_year" json:"notary_year"`
	NotaryProtocolNumber string `form:"notary_protocol_number" json:"notary_protocol_number"`
	ContractCheckBase    string `form:"contract_base" json:"contract_base"`
	Annex                string `form:"annex" json:"annex"`
}

type ELSI_IDTokenClaims

type ELSI_IDTokenClaims struct {
	Audience               string `json:"aud"`
	CertificateType        string `json:"elsi_certificate_type"`
	Country                string `json:"country"`
	Organization           string `json:"organization"`
	OrganizationalUnit     string `json:"organizational_unit"`
	OrganizationIdentifier string `json:"organization_identifier"`
	SerialNumber           string `json:"serial_number"`
	Expiration             int64  `json:"exp"`
	IssuedAt               int64  `json:"iat"`
	Issuer                 string `json:"iss"`
	Name                   string `json:"name"`
	Nonce                  string `json:"nonce"`
	Subject                string `json:"sub"`
	CommonName             string `json:"common_name"`
	Surname                string `json:"surname"`
	FamilyName             string `json:"family_name"`
	GivenName              string `json:"given_name"`
	Email                  string `json:"email"`
	Locality               string `json:"locality"`
	Province               string `json:"province"`
	StreetAddress          string `json:"street_address"`
	PostalCode             string `json:"postal_code"`
	ValidFrom              int64  `json:"valid_from"`
	ValidTo                int64  `json:"valid_to"`
	ValidFromStr           string `json:"-"`
	ValidToStr             string `json:"-"`
}

func (*ELSI_IDTokenClaims) GetAudience

func (c *ELSI_IDTokenClaims) GetAudience() (jwt.ClaimStrings, error)

func (*ELSI_IDTokenClaims) GetExpirationTime

func (c *ELSI_IDTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)

func (*ELSI_IDTokenClaims) GetIssuedAt

func (c *ELSI_IDTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)

func (*ELSI_IDTokenClaims) GetIssuer

func (c *ELSI_IDTokenClaims) GetIssuer() (string, error)

func (*ELSI_IDTokenClaims) GetNotBefore

func (c *ELSI_IDTokenClaims) GetNotBefore() (*jwt.NumericDate, error)

func (*ELSI_IDTokenClaims) GetSubject

func (c *ELSI_IDTokenClaims) GetSubject() (string, error)

type IDToken

type IDToken struct {
	Issuer          string         `json:"iss"`
	Subject         string         `json:"sub"`
	Audience        string         `json:"aud"`
	Expiration      int64          `json:"exp"`
	IssuedAt        int64          `json:"iat"`
	Nonce           string         `json:"nonce,omitempty"`
	AccessTokenHash string         `json:"at_hash,omitempty"`
	CustomClaims    map[string]any `json:"custom_claims"`
}

IDToken represents an OpenID Connect ID token

type RPSession

type RPSession struct {
	SessionID     string           `json:"session_id"`
	UserID        string           `json:"user_id"`
	UserInfo      *CertificateData `json:"user_info"`
	AccessToken   string           `json:"access_token"`
	IDToken       string           `json:"id_token"`
	CreatedAt     time.Time        `json:"created_at"`
	LastAccessed  time.Time        `json:"last_accessed"`
	IDTokenClaims jwt.MapClaims    `json:"id_token_claims"`
}

RPSession represents a user session in the example RP

type RelyingParty

type RelyingParty struct {
	ID               int       `json:"id"`
	Name             string    `json:"name"`
	Description      string    `json:"description"`
	ClientID         string    `json:"client_id"`
	ClientSecretHash string    `json:"-"` // Never expose in JSON
	RedirectURL      string    `json:"redirect_url"`
	Scopes           string    `json:"scopes"`
	TokenExpiry      int       `json:"token_expiry"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

RelyingParty represents a registered OIDC relying party

type SSOSession

type SSOSession struct {
	SessionID       string           `json:"session_id"`
	CertificateData *CertificateData `json:"certificate_data,omitempty"`
	Email           string           `json:"email,omitempty"`
}

SSOSession represents a single sign-on session, stored in-memory in the server This supports several RPs using the same certificate without having to re-authenticate the user.

type TokenRequest

type TokenRequest struct {
	GrantType    string `form:"grant_type"`
	Code         string `form:"code"`
	CodeVerifier string `form:"code_verifier"`
	RedirectURI  string `form:"redirect_uri"`
	ClientID     string `form:"client_id"`
}

TokenRequest represents a token exchange request

type TokenResponse

type TokenResponse struct {
	AccessToken string         `json:"access_token"`
	TokenType   string         `json:"token_type"`
	ExpiresIn   int            `json:"expires_in"`
	Scope       string         `json:"scope"`
	Claims      map[string]any `json:"claims"`
	IdToken     string         `json:"id_token,omitempty"`
}

TokenResponse represents an OAuth2 response to the token endpoint

Jump to

Keyboard shortcuts

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