helpers

package
v0.0.0-...-9637607 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenIDConnectKeyName = "hydra.openid.id-token"
	OAuth2JWTKeyName     = "hydra.jwt.access-token"
)

Variables

View Source
var (
	ErrNotFound = &fosite.RFC6749Error{
		CodeField:        http.StatusNotFound,
		ErrorField:       http.StatusText(http.StatusNotFound),
		DescriptionField: "Unable to located the requested resource",
	}
	ErrConflict = &fosite.RFC6749Error{
		CodeField:        http.StatusConflict,
		ErrorField:       http.StatusText(http.StatusConflict),
		DescriptionField: "Unable to process the requested resource because of conflict in the current state",
	}
)

Functions

func ApplyJSONPatch

func ApplyJSONPatch(p json.RawMessage, object interface{}, denyPaths ...string) error

func CleanSQL

func CleanSQL(t *testing.T, db *sqlx.DB)

func CleanSQLPop

func CleanSQLPop(t *testing.T, c *pop.Connection)

func ErrorEnhancer

func ErrorEnhancer(r *http.Request, err error) interface{}

func GenerateSecret

func GenerateSecret(length int) ([]byte, error)

func HashByteSecret

func HashByteSecret(secret []byte) []byte

HashByteSecret hashes the secret for consumption by the AEAD encryption algorithm which expects exactly 32 bytes.

The system secret is being hashed to always match exactly the 32 bytes required by AEAD, even if the secret is long or shorter.

func HashStringSecret

func HashStringSecret(secret string) []byte

HashStringSecret hashes the secret for consumption by the AEAD encryption algorithm which expects exactly 32 bytes.

The system secret is being hashed to always match exactly the 32 bytes required by AEAD, even if the secret is long or shorter.

func IsRedirectURISecure

func IsRedirectURISecure(rc redirectConfiguration) func(redirectURI *url.URL) bool

func LogAudit

func LogAudit(r *http.Request, message interface{}, logger *logrusx.Logger)

func LogError

func LogError(r *http.Request, err error, logger *logrusx.Logger)

func MatchesRange

func MatchesRange(r *http.Request, ranges []string) error

func RejectInsecureRequests

func RejectInsecureRequests(reg tlsRegistry, c tlsConfig) negroni.HandlerFunc

func UrlRoot

func UrlRoot(u *url.URL) *url.URL

Types

type BCrypt

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

BCrypt implements a BCrypt hasher.

func NewBCrypt

func NewBCrypt(c config) *BCrypt

NewBCrypt returns a new BCrypt instance.

func (*BCrypt) Compare

func (b *BCrypt) Compare(ctx context.Context, hash, data []byte) error

func (*BCrypt) Hash

func (b *BCrypt) Hash(ctx context.Context, data []byte) ([]byte, error)

type FositeStorer

type FositeStorer interface {
	fosite.Storage
	oauth2.CoreStorage
	openid.OpenIDConnectRequestStorage
	pkce.PKCERequestStorage

	RevokeRefreshToken(ctx context.Context, requestID string) error

	RevokeAccessToken(ctx context.Context, requestID string) error

	// flush the access token requests from the database.
	// no data will be deleted after the 'notAfter' timeframe.
	FlushInactiveAccessTokens(ctx context.Context, notAfter time.Time, limit int, batchSize int) error

	// flush the login requests from the database.
	// this will address the database long-term growth issues discussed in https://github.com/ory/hydra/issues/1574.
	// no data will be deleted after the 'notAfter' timeframe.
	FlushInactiveLoginConsentRequests(ctx context.Context, notAfter time.Time, limit int, batchSize int) error

	DeleteAccessTokens(ctx context.Context, clientID string) error

	FlushInactiveRefreshTokens(ctx context.Context, notAfter time.Time, limit int, batchSize int) error
}

type JoseJSONWebKeySet

type JoseJSONWebKeySet struct {
	// swagger:ignore
	*jose.JSONWebKeySet
}

swagger:type JSONWebKeySet

func (*JoseJSONWebKeySet) Scan

func (n *JoseJSONWebKeySet) Scan(value interface{}) error

func (*JoseJSONWebKeySet) Value

func (n *JoseJSONWebKeySet) Value() (driver.Value, error)

type RegistryCookieStore

type RegistryCookieStore interface {
	CookieStore() sessions.Store
}

type RegistryLogger

type RegistryLogger interface {
	Logger() *logrusx.Logger
	AuditLogger() *logrusx.Logger
}

type RegistryWriter

type RegistryWriter interface {
	Writer() herodot.Writer
}

type RouterAdmin

type RouterAdmin struct {
	*httprouter.Router
}

func NewRouterAdmin

func NewRouterAdmin() *RouterAdmin

func (*RouterAdmin) RouterPublic

func (r *RouterAdmin) RouterPublic() *RouterPublic

type RouterPublic

type RouterPublic struct {
	*httprouter.Router
}

func NewRouterPublic

func NewRouterPublic() *RouterPublic

func (*RouterPublic) RouterAdmin

func (r *RouterPublic) RouterAdmin() *RouterAdmin

type TracingProvider

type TracingProvider interface {
	Tracer(ctx context.Context) *tracing.Tracer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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