model

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttrScope      = "scope"
	AttrAud        = "audience"
	AttrCapability = "capability"
)

Defined attributes

Variables

View Source
var AllRestrictionKeyStrings = api.AllRestrictionKeys

AllRestrictionKeyStrings holds all defined RestrictionKey strings

Attributes holds all defined attributes

View Source
var ResponseNYI = Response{Status: fiber.StatusNotImplemented, Response: api.ErrorNYI}

ResponseNYI is the server response when something is not yet implemented

Functions

This section is empty.

Types

type Response

type Response struct {
	// The Http Status code of the response
	Status int
	// The response body, will be marshalled as json
	Response interface{}
	// Cookies that should be set
	Cookies []*fiber.Cookie
}

Response models a http server response

func ErrorToBadRequestErrorResponse

func ErrorToBadRequestErrorResponse(err error) *Response

ErrorToBadRequestErrorResponse creates a bad request error response from a golang error

func ErrorToInternalServerErrorResponse

func ErrorToInternalServerErrorResponse(err error) *Response

ErrorToInternalServerErrorResponse creates an internal server error response from a golang error

func (Response) Send

func (r Response) Send(ctx *fiber.Ctx) error

Send sends this response using the passed fiber.Ctx

type RestrictionKey added in v0.3.0

type RestrictionKey int

RestrictionKey is an enum like type for restriction keys

const (
	RestrictionKeyNotBefore RestrictionKey = iota
	RestrictionKeyExpiresAt
	RestrictionKeyScope
	RestrictionKeyAudiences
	RestrictionKeyIPs
	RestrictionKeyGeoIPAllow
	RestrictionKeyGeoIPDisallow
	RestrictionKeyUsagesAT
	RestrictionKeyUsagesOther
)

RestrictionKeys

func NewRestrictionKey added in v0.3.0

func NewRestrictionKey(s string) RestrictionKey

NewRestrictionKey creates a new RestrictionKey from the grant type string

func (RestrictionKey) MarshalJSON added in v0.3.0

func (rk RestrictionKey) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*RestrictionKey) String added in v0.3.0

func (rk *RestrictionKey) String() string

func (*RestrictionKey) UnmarshalJSON added in v0.3.0

func (rk *RestrictionKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface

func (*RestrictionKey) UnmarshalText added in v0.3.0

func (rk *RestrictionKey) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface

func (*RestrictionKey) UnmarshalYAML added in v0.3.0

func (rk *RestrictionKey) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface

func (*RestrictionKey) Valid added in v0.3.0

func (rk *RestrictionKey) Valid() bool

Valid checks that RestrictionKey is a defined grant type

type RestrictionKeys added in v0.3.0

type RestrictionKeys []RestrictionKey

RestrictionKeys is a slice of RestrictionKey

var AllRestrictionKeys RestrictionKeys

AllRestrictionKeys holds all defined RestrictionKeys

func (RestrictionKeys) Disable added in v0.3.0

func (rks RestrictionKeys) Disable(disable RestrictionKeys) (left RestrictionKeys)

Disable subtracts the passed RestrictionKeys from this RestrictionKeys and returns the left RestrictionKeys

func (RestrictionKeys) Has added in v0.3.0

func (rks RestrictionKeys) Has(rk RestrictionKey) bool

Has checks if a a RestrictionKey is in a RestrictionKeys

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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