Documentation
¶
Index ¶
- Variables
- func FetchURLWithTimeout(ctx context.Context, urlStr string, timeout time.Duration) (*http.Response, error)
- func GetBodyBytes(req *http.Request) ([]byte, error)
- func GetIPAddress(r *http.Request) string
- func GetReferrer(r *http.Request, config *conf.GlobalConfiguration) string
- func GetRequestID(ctx context.Context) string
- func IsRedirectURLValid(config *conf.GlobalConfiguration, redirectURL string) bool
- func SafeClose(closer io.Closer)
- func StringPtr(s string) *string
- func StringValue(s *string) string
- func ValidateOAuthURL(urlStr string) error
- func WaitForCleanup(ctx context.Context, wg *sync.WaitGroup)
- func WithRequestID(ctx context.Context, id string) context.Context
- type HIBPBloomCache
- type PostgresError
Constants ¶
This section is empty.
Variables ¶
var Version string
Version is git commit or release tag from which this binary was built.
Functions ¶
func FetchURLWithTimeout ¶
func FetchURLWithTimeout(ctx context.Context, urlStr string, timeout time.Duration) (*http.Response, error)
FetchURLWithTimeout fetches a URL with timeout and SSRF protection This is used for fetching OIDC discovery documents and JWKS
func GetBodyBytes ¶
GetBodyBytes reads the whole request body properly into a byte array.
func GetIPAddress ¶
GetIPAddress returns the real IP address of the HTTP request.
func GetReferrer ¶
func GetReferrer(r *http.Request, config *conf.GlobalConfiguration) string
func GetRequestID ¶
GetRequestID reads the request ID from the context.
func IsRedirectURLValid ¶
func IsRedirectURLValid(config *conf.GlobalConfiguration, redirectURL string) bool
func StringValue ¶
StringValue safely extracts a string from a *string, returning empty string if nil
func ValidateOAuthURL ¶
ValidateOAuthURL validates that a URL is safe for OAuth/OIDC operations and protects against SSRF attacks by blocking private IPs and metadata endpoints
func WaitForCleanup ¶
WaitForCleanup waits until all long-running goroutines shut down cleanly or until the provided context signals done.
Types ¶
type HIBPBloomCache ¶
func NewHIBPBloomCache ¶
func NewHIBPBloomCache(n uint, fp float64) *HIBPBloomCache
func (*HIBPBloomCache) Cap ¶
func (c *HIBPBloomCache) Cap() uint
type PostgresError ¶
type PostgresError struct {
Code string `json:"code"`
HttpStatusCode int `json:"-"`
Message string `json:"message"`
Hint string `json:"hint,omitempty"`
Detail string `json:"detail,omitempty"`
}
PostgresError is a custom error struct for marshalling Postgres errors to JSON.
func NewPostgresError ¶
func NewPostgresError(err error) *PostgresError
NewPostgresError returns a new PostgresError if the error was from a publicly accessible Postgres error.
func (*PostgresError) IsUniqueConstraintViolated ¶
func (pg *PostgresError) IsUniqueConstraintViolated() bool