idpd

package module
v0.0.0-...-535d45a Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2025 License: Apache-2.0 Imports: 44 Imported by: 0

README

Downloads Build Coverage

About IdPD

Documentation

Index

Constants

View Source
const DefaultConfig string = "/etc/idpd/idpd.toml"

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, args []string) error

Types

type Alert

type Alert string
const (
	AlertNone          Alert = ""
	AlertServerFailure Alert = "server_failure"
	AlertLoginFailure  Alert = "login_failure"
	AlertLogoffFailure Alert = "logoff_failure"
	AlertVerifyFailure Alert = "verify_failure"
)

type Config

type Config struct {
	Logging struct {
		Level          string `toml:"level"`
		Target         string `toml:"target"`
		Color          int    `toml:"color"`
		FileName       string `toml:"file_name"`
		FileSizeLimit  int64  `toml:"file_size_limit"`
		SyslogNetwork  string `toml:"syslog_network"`
		SyslogAddress  string `toml:"syslog_address"`
		SyslogEncoding string `toml:"syslog_encoding"`
		SyslogFacility int    `toml:"syslog_facility"`
	} `toml:"logging"`
	Server struct {
		Address             string         `toml:"address"`
		Protocol            ServerProtocol `toml:"protocol"`
		AccessLog           bool           `toml:"access_log"`
		CertFile            string         `toml:"cert_file"`
		KeyFile             string         `toml:"key_file"`
		PublicURL           URLSpec        `toml:"public_url"`
		SessionCookie       string         `toml:"session_cookie"`
		SessionCookieDomain string         `toml:"session_cookie_domain"`
		SessionLifetime     DurationSpec   `toml:"session_lifetime"`
		RequestLifetime     DurationSpec   `toml:"request_lifetime"`
		TokenLifetime       DurationSpec   `toml:"token_lifetime"`
		AllowedOrigins      []string       `toml:"allowed_origins"`
	} `toml:"server"`
	AccessPolicies struct {
		Trusted []NetworkSpec `toml:"trusted"`
		Private []NetworkSpec `toml:"private"`
	} `toml:"access_policies"`
	Mail struct {
		Address     string `toml:"address"`
		User        string `toml:"user"`
		Password    string `toml:"password"`
		FromAddress string `toml:"from_address"`
		FromName    string `toml:"from_name"`
	} `toml:"mail"`
	TOTP struct {
		Issuer string `toml:"issuer"`
	} `toml:"totp"`
	GeoIP struct {
		CityDB   string `toml:"city_db"`
		Mappings []struct {
			Networks []NetworkSpec `toml:"networks"`
			Host     string        `toml:"host"`
		} `toml:"mapping"`
	} `toml:"geoip"`
	Database struct {
		Type   DatabaseType `toml:"type"`
		Memory struct {
		} `toml:"memory"`
		SQLite struct {
			File string `toml:"file"`
		} `toml:"sqlite"`
		Postgres struct {
			Address  string `toml:"address"`
			DB       string `toml:"db"`
			User     string `toml:"user"`
			Password string `toml:"password"`
		} `toml:"postgres"`
	} `toml:"database"`
	UserStore struct {
		Type UserStoreType `toml:"type"`
		LDAP struct {
			URLs          []URLSpec   `toml:"urls"`
			BindDN        string      `toml:"bind_dn"`
			BindPassword  string      `toml:"bind_password"`
			UserBaseDN    string      `toml:"user_base_dn"`
			UserFilter    string      `toml:"user_filter"`
			GroupBaseDN   string      `toml:"group_base_dn"`
			GroupFilter   string      `toml:"group_filter"`
			Mapping       LDAPMapping `toml:"mapping"`
			CustomMapping struct {
				User struct {
					Profile struct {
						Name              string `toml:"name"`
						GivenName         string `toml:"given_name"`
						FamilyName        string `toml:"family_name"`
						MiddleName        string `toml:"middle_name"`
						Nickname          string `toml:"nickname"`
						Profile           string `toml:"profile"`
						Picture           string `toml:"picture"`
						Website           string `toml:"website"`
						Birthdate         string `toml:"birthdate"`
						Zoneinfo          string `toml:"zoneinfo"`
						Locale            string `toml:"locale"`
						PreferredUsername string `toml:"preferred_username"`
						UpdatedAt         string `toml:"update_at"`
					} `toml:"profile"`
					Address struct {
						Formatted  string `toml:"formatted"`
						Street     string `toml:"street"`
						Locality   string `toml:"locality"`
						Region     string `toml:"region"`
						PostalCode string `toml:"postal_code"`
						Country    string `toml:"country"`
					} `toml:"address"`
					Phone struct {
						Number string `toml:"number"`
					} `toml:"phone"`
					Email struct {
						Address string `toml:"address"`
					} `toml:"email"`
					Groups string `toml:"groups"`
				} `toml:"user"`
				Group struct {
					Name    string `toml:"name"`
					Members string `toml:"members"`
				} `toml:"group"`
			} `toml:"custom_mapping"`
		} `toml:"ldap"`
		Static []struct {
			Subject  string `toml:"subject"`
			Password string `toml:"password"`
			Profile  struct {
				Name              string `toml:"name"`
				GivenName         string `toml:"given_name"`
				FamilyName        string `toml:"family_name"`
				MiddleName        string `toml:"middle_name"`
				Nickname          string `toml:"nickname"`
				Profile           string `toml:"profile"`
				Picture           string `toml:"picture"`
				Website           string `toml:"website"`
				Birthdate         string `toml:"birthdate"`
				Zoneinfo          string `toml:"zoneinfo"`
				Locale            string `toml:"locale"`
				PreferredUsername string `toml:"preferred_username"`
			} `toml:"profile"`
			Address struct {
				Formatted  string `toml:"formatted"`
				Street     string `toml:"street"`
				Locality   string `toml:"locality"`
				Region     string `toml:"region"`
				PostalCode string `toml:"postal_code"`
				Country    string `toml:"country"`
			} `toml:"address"`
			Phone struct {
				Number string `toml:"number"`
			} `toml:"phone"`
			Email struct {
				Address string `toml:"address"`
			} `toml:"email"`
			Groups []string `toml:"groups"`
		} `toml:"static"`
	} `toml:"userstore"`
	OAuth2 struct {
		DefaultLogoutRedirectURL string              `toml:"default_logout_redirect_url"`
		SigningKeyAlgorithm      SigningKeyAlgorithm `toml:"signing_key_algorithm"`
		SigningKeyLifetime       DurationSpec        `toml:"signing_key_lifetime"`
		SigningKeyExpiry         DurationSpec        `toml:"signing_key_expiry"`
		Clients                  []OAuth2Client      `toml:"client"`
	} `toml:"oauth2"`
	Mock struct {
		Enabled  bool   `toml:"enabled"`
		Subject  string `toml:"subject"`
		Password string `toml:"password"`
		Rembemer bool   `toml:"remember"`
	} `toml:"mock"`
	Tracing struct {
		Enabled       bool              `toml:"enabled"`
		EndpointURL   URLSpec           `toml:"endpoint_url"`
		Protocol      TracingProtocol   `toml:"protocol"`
		Headers       map[string]string `toml:"headers"`
		BatchTimeout  DurationSpec      `toml:"batch_timeout"`
		ExportTimeout DurationSpec      `toml:"export_timeout"`
	} `toml:"tracing"`
}

func LoadConfig

func LoadConfig(path string, strict bool) (*Config, error)

type DatabaseType

type DatabaseType string
const (
	DatabaseTypeMemory   DatabaseType = "memory"
	DatabaseTypeSqlite   DatabaseType = "sqlite"
	DatabaseTypePostgres DatabaseType = "postgres"
)

func (*DatabaseType) MarshalTOML

func (t *DatabaseType) MarshalTOML() ([]byte, error)

func (*DatabaseType) UnmarshalTOML

func (t *DatabaseType) UnmarshalTOML(value any) error

func (*DatabaseType) Value

func (t *DatabaseType) Value() string

type DurationSpec

type DurationSpec struct {
	time.Duration
}

func (*DurationSpec) MarshalTOML

func (d *DurationSpec) MarshalTOML() ([]byte, error)

func (*DurationSpec) UnmarshalTOML

func (d *DurationSpec) UnmarshalTOML(value any) error

func (*DurationSpec) Value

func (d *DurationSpec) Value() string

type LDAPMapping

type LDAPMapping string
const (
	LDAPMappingActiveDirectory LDAPMapping = "active_directory"
	LDAPMappingOpenLDAP        LDAPMapping = "openldap"
	LDAPMappingCustom          LDAPMapping = "custom"
)

func (*LDAPMapping) MarshalTOML

func (m *LDAPMapping) MarshalTOML() ([]byte, error)

func (*LDAPMapping) UnmarshalTOML

func (m *LDAPMapping) UnmarshalTOML(value any) error

func (*LDAPMapping) Value

func (m *LDAPMapping) Value() string

type NetworkSpec

type NetworkSpec struct {
	net.IPNet
}

func (*NetworkSpec) MarshalTOML

func (network *NetworkSpec) MarshalTOML() ([]byte, error)

func (*NetworkSpec) UnmarshalTOML

func (network *NetworkSpec) UnmarshalTOML(value any) error

func (*NetworkSpec) Value

func (network *NetworkSpec) Value() string

type OAuth2Client

type OAuth2Client struct {
	ID                     string    `toml:"id"`
	Secret                 string    `toml:"secret"`
	RedirectURLs           []URLSpec `toml:"redirect_urls"`
	PostLogoutRedirectURLs []URLSpec `toml:"post_logout_redirect_urls"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func MustStart

func MustStart(ctx context.Context, path string) *Server

func Start

func Start(ctx context.Context, path string) (*Server, error)

func (*Server) AddOAuth2Client

func (s *Server) AddOAuth2Client(client *OAuth2Client) error

func (*Server) OAuth2IssuerURL

func (s *Server) OAuth2IssuerURL() *url.URL

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context)

func (*Server) WaitStopped

func (s *Server) WaitStopped()

type ServerProtocol

type ServerProtocol string
const (
	ServerProtocolHttp  ServerProtocol = "http"
	ServerProtocolHttps ServerProtocol = "https"
)

func (*ServerProtocol) MarshalTOML

func (p *ServerProtocol) MarshalTOML() ([]byte, error)

func (*ServerProtocol) UnmarshalTOML

func (p *ServerProtocol) UnmarshalTOML(value any) error

func (*ServerProtocol) Value

func (p *ServerProtocol) Value() string

type SigningKeyAlgorithm

type SigningKeyAlgorithm string
const (
	SigningKeyAlgorithmRS256 SigningKeyAlgorithm = "RS256"
	SigningKeyAlgorithmES256 SigningKeyAlgorithm = "ES256"
	SigningKeyAlgorithmPS256 SigningKeyAlgorithm = "PS256"
)

func (*SigningKeyAlgorithm) MarshalTOML

func (a *SigningKeyAlgorithm) MarshalTOML() ([]byte, error)

func (*SigningKeyAlgorithm) UnmarshalTOML

func (a *SigningKeyAlgorithm) UnmarshalTOML(value any) error

func (*SigningKeyAlgorithm) Value

func (a *SigningKeyAlgorithm) Value() string

type TracingProtocol

type TracingProtocol string
const (
	TracingProtocolHttp TracingProtocol = "http"
	TracingProtocolGRPC TracingProtocol = "gRPC"
)

func (*TracingProtocol) MarshalTOML

func (p *TracingProtocol) MarshalTOML() ([]byte, error)

func (*TracingProtocol) UnmarshalTOML

func (p *TracingProtocol) UnmarshalTOML(value any) error

func (*TracingProtocol) Value

func (p *TracingProtocol) Value() string

type URLSpec

type URLSpec struct {
	url.URL
}

func (*URLSpec) MarshalTOML

func (url *URLSpec) MarshalTOML() ([]byte, error)

func (*URLSpec) UnmarshalTOML

func (url *URLSpec) UnmarshalTOML(value any) error

func (*URLSpec) Value

func (url *URLSpec) Value() string

type UserInfo

type UserInfo struct {
	Name                 string              `json:"name"`
	Subject              string              `json:"subject"`
	Email                string              `json:"email"`
	EmailVerification    UserVerificationLog `json:"email_verification"`
	TOTPVerification     UserVerificationLog `json:"totp_verification"`
	PasskeyVerification  UserVerificationLog `json:"passkey_verification"`
	WebAuthnVerification UserVerificationLog `json:"webauthn_verification"`
	ClientID             string              `json:"client_id"`
	RequestedScopes      []string            `json:"requested_scopes"`
}

type UserStoreType

type UserStoreType string
const (
	UserStoreTypeLDAP   UserStoreType = "ldap"
	UserStoreTypeStatic UserStoreType = "static"
)

func (*UserStoreType) MarshalTOML

func (t *UserStoreType) MarshalTOML() ([]byte, error)

func (*UserStoreType) UnmarshalTOML

func (t *UserStoreType) UnmarshalTOML(value any) error

func (*UserStoreType) Value

func (t *UserStoreType) Value() string

type UserTOTPRegistrationRequest

type UserTOTPRegistrationRequest struct {
	QRCode string `json:"qr_code"`
	OTPUrl string `json:"otp_url"`
}

type UserVerificationLog

type UserVerificationLog struct {
	Registration time.Time `json:"registration,omitzero"`
	LastUsed     time.Time `json:"last_used,omitzero"`
	Host         string    `json:"host"`
	Country      string    `json:"country,omitempty"`
	CountryCode  string    `json:"country_code,omitempty"`
	City         string    `json:"city,omitempty"`
	Lat          float64   `json:"lat"`
	Lon          float64   `json:"lon"`
}

Directories

Path Synopsis
cmd
idpd command
Package httpserver provides http server functionality for this library in a pluggable manner.
Package httpserver provides http server functionality for this library in a pluggable manner.
internal

Jump to

Keyboard shortcuts

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