Documentation ¶
Index ¶
- func AuthorizationFromHeader(req *http.Request) (string, error)
- func AuthorizationFromParam(req *http.Request) (string, error)
- func AuthorizationFromRequest(req *http.Request) (string, error)
- func ContextClient(ctx context.Context) (*http.Client, error)
- func ContextTransport(ctx context.Context) http.RoundTripper
- func RegisterContextClientFunc(fn ContextClientFunc)
- func RegisterRequestContextFunc(fn RequestContextFunc)
- func RequestContext(req *http.Request) (context.Context, error)
- func ServerAllowedOrigins(origins []string) func(*Server)
- func ServerGenerateURI(uri string) func(*Server)
- func ServerVerifyURI(uri string) func(*Server)
- func WithCredentials(creds *Credentials) func(*Config) error
- func WithCredentialsPath(path string) func(*Config) error
- func WithName(name string) func(*Config) error
- type App
- type Auth
- func (a *Auth) AllRoles(h http.Handler, roles ...string) http.Handler
- func (a *Auth) AnyRole(h http.Handler, roles ...string) http.Handler
- func (a *Auth) Authenticated(h http.Handler, roles ...string) http.Handler
- func (a *Auth) Authorize(h http.Handler, authFn AuthFunc) http.Handler
- func (a *Auth) CreateCustomToken(uid string, developerClaims *Claims) (string, error)
- func (a *Auth) Server(claimsFn CreateClaimsFunc, options ...func(*Server)) http.Handler
- func (a *Auth) VerifyIDToken(ctx context.Context, token string) (*Token, error)
- type AuthFunc
- type Claims
- type Config
- type ContextClientFunc
- type ContextKey
- type CreateClaimsFunc
- type Credentials
- type ErrorTransport
- type Option
- type RequestContextFunc
- type Server
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextTransport ¶
func ContextTransport(ctx context.Context) http.RoundTripper
func RegisterContextClientFunc ¶
func RegisterContextClientFunc(fn ContextClientFunc)
func RegisterRequestContextFunc ¶
func RegisterRequestContextFunc(fn RequestContextFunc)
func ServerAllowedOrigins ¶
ServerAllowedOrigins sets AllowedOrigins for CORS
func ServerGenerateURI ¶
ServerGenerateURI Sets URI for the token generation
func ServerVerifyURI ¶
ServerVerifyURI Sets URI for token verification
func WithCredentials ¶
func WithCredentials(creds *Credentials) func(*Config) error
WithCredentials sets the credentials
func WithCredentialsPath ¶
WithCredentialsPath sets the path to load credentials from
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) Authenticated ¶
func (*Auth) CreateCustomToken ¶
type Claims ¶
type Claims map[string]interface{}
Claims to be stored in a custom token (and made available to security rules in Database, Storage, etc.). These must be serializable to JSON (e.g. contains only Maps, Arrays, Strings, Booleans, Numbers, etc.).
type Config ¶
type Config struct { Name string Credentials *Credentials CredentialsPath string }
Config stores firebase app configuration settings
type ContextClientFunc ¶
ContextClientFunc is a func which tries to return an *http.Client given a Context value. If it returns an error, the search stops with that error. If it returns (nil, nil), the search continues down the list of registered funcs.
type ContextKey ¶
type ContextKey struct{}
ContextKey is just an empty struct. It exists so HTTPClient can be an immutable public variable with a unique type. It's immutable because nobody else can create a ContextKey, being unexported.
var HTTPClient ContextKey
HTTPClient is the context key to use with golang.org/x/net/context's WithValue function to associate an *http.Client value with a context.
type Credentials ¶
type Credentials struct { // ProjectID is the project ID. ProjectID string // PrivateKey is the RSA256 private key. PrivateKey *rsa.PrivateKey // ClientEmail is the client email. ClientEmail string }
func (*Credentials) UnmarshalJSON ¶
func (c *Credentials) UnmarshalJSON(data []byte) error
UnmarshalJSON is the custom unmarshaler for GoogleServiceAccountCredential. Private key is parsed from PEM format.
type ErrorTransport ¶
type ErrorTransport struct{ Err error }
ErrorTransport returns the specified error on RoundTrip. This RoundTripper should be used in rare error cases where error handling can be postponed to response handling time.
type RequestContextFunc ¶
RequestContextFunc is a func which tries to return a context.Context given a Request value. If it returns an error, the search stops with that error. If it returns (nil, nil), the search continues down the list of registered funcs.
type Token ¶
func (*Token) IsEmailVerified ¶
IsEmailVerified indicates if the email address returned by Email() has been verified as good.