web

package
v0.0.0-...-2540832 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2017 License: BSD-3-Clause Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Activation

func Activation(w http.ResponseWriter, r *http.Request)

Activation removes an existing activation code from an account, thus rendering the account active.

func Approve

func Approve(w http.ResponseWriter, r *http.Request)

Approve evaluates an access approval given to a certain client.

func ApprovePage

func ApprovePage(w http.ResponseWriter, r *http.Request)

ApprovePage shows a page where the user can approve client access.

func Authorize

func Authorize(w http.ResponseWriter, r *http.Request)

Authorize handles the beginning of an OAuth grant request following the schema of any of the 'implicit', 'code', 'owner' or 'client' grant types.

func CreateKey

func CreateKey(w http.ResponseWriter, r *http.Request)

CreateKey stores a new key for a given account.

func DeleteKey

func DeleteKey(w http.ResponseWriter, r *http.Request)

DeleteKey removes a single ssh key identified by its fingerprint and returns the deleted key as JSON.

func GetAccount

func GetAccount(w http.ResponseWriter, r *http.Request)

GetAccount is a handler which returns a requested account as JSON

func GetKey

func GetKey(w http.ResponseWriter, r *http.Request)

GetKey returns a single ssh key identified by its fingerprint as JSON.

func ListAccountKeys

func ListAccountKeys(w http.ResponseWriter, r *http.Request)

ListAccountKeys is a handler which returns all ssh keys belonging to a given account as JSON.

func ListAccounts

func ListAccounts(w http.ResponseWriter, r *http.Request)

ListAccounts is a handler which returns a list of existing accounts as JSON

func LoginPage

func LoginPage(w http.ResponseWriter, r *http.Request)

LoginPage shows a page where the user can enter his credentials.

func LoginWithCredentials

func LoginWithCredentials(w http.ResponseWriter, r *http.Request)

LoginWithCredentials validates user credentials.

func LoginWithSession

func LoginWithSession(w http.ResponseWriter, r *http.Request)

LoginWithSession validates session cookie.

func Logout

func Logout(w http.ResponseWriter, r *http.Request)

Logout remove a valid token (and if present the session cookie too) so it can't be used any more.

func OAuthHandler

func OAuthHandler(scope ...string) func(http.Handler) http.Handler

OAuthHandler processes a request and extracts a bearer token from the authorization header. If the bearer token is valid and has a matching scope the respective AccessToken data can later be obtained using the OAuthToken function.

func OAuthHandlerPermissive

func OAuthHandlerPermissive() func(http.Handler) http.Handler

OAuthHandlerPermissive processes a request and extracts a bearer token from the authorization header. If the bearer token is valid and has a matching scope the respective AccessToken data can later be obtained using the OAuthToken function. A permissive handler does not strictly require the presence of a bearer token. In this case the request is handled normally but no OAuth information is present in subsequent handlers.

func PrintErrorHTML

func PrintErrorHTML(w http.ResponseWriter, r *http.Request, err interface{}, code int)

PrintErrorHTML shows an html error page.

func PrintErrorJSON

func PrintErrorJSON(w http.ResponseWriter, r *http.Request, err interface{}, code int)

PrintErrorJSON writes an JSON error response.

func RegisterRoutes

func RegisterRoutes(r *mux.Router)

RegisterRoutes adds all registered routes for this app to the main router. This should make it easier to get a quick overview over all routes.

func RegisteredPage

func RegisteredPage(w http.ResponseWriter, r *http.Request)

RegisteredPage displays gin account activation information and redirects back to the grant request redirection URI after a brief delay using java script.

func RegistrationHandler

func RegistrationHandler(f func(string, string) bool) http.Handler

RegistrationHandler provides an http handler for account registration.

func RegistrationInit

func RegistrationInit(w http.ResponseWriter, r *http.Request)

RegistrationInit creates a grant request for an account registration and redirects to the actual registration entry form.

func RegistrationPage

func RegistrationPage(w http.ResponseWriter, r *http.Request)

RegistrationPage displays entry fields required for the creation of a new gin account

func Reset

func Reset(w http.ResponseWriter, r *http.Request)

Reset checks whether a submitted password reset code exists and is still valid. It further checks, whether posted password and confirm password are identical and updates the account associated with the password reset code with the new password. This update further removes any existing password reset and account activation codes rendering the account active.

func ResetInit

func ResetInit(w http.ResponseWriter, r *http.Request)

ResetInit checks whether a provided login or e-mail address belongs to a non-disabled account. If this is the case, the corresponding account is updated with a password reset code and an email containing the code is sent to the e-mail address of the account.

func ResetInitPage

func ResetInitPage(w http.ResponseWriter, r *http.Request)

ResetInitPage provides an input form for resetting an account password

func ResetPage

func ResetPage(w http.ResponseWriter, r *http.Request)

ResetPage checks whether a password reset code submitted by request URI query exists and is still valid. Display enter password form if valid, an error message otherwise.

func Token

func Token(w http.ResponseWriter, r *http.Request)

Token exchanges a grant code for an access and refresh token

func UpdateAccount

func UpdateAccount(w http.ResponseWriter, r *http.Request)

UpdateAccount is a handler which updated all updatable fields of an account (Title, FirstName, MiddleName and LastName) and returns the updated account as JSON

func UpdateAccountEmail

func UpdateAccountEmail(w http.ResponseWriter, r *http.Request)

UpdateAccountEmail parses an e-mail address and the account password from a JSON request body and updates the e-mail address of the authorized account.

func UpdateAccountPassword

func UpdateAccountPassword(w http.ResponseWriter, r *http.Request)

UpdateAccountPassword is a handler which parses the old and new password from the request body and updates the accounts password. Returns StatusOK and an empty body on success.

func Validate

func Validate(w http.ResponseWriter, r *http.Request)

Validate validates a token and returns information about it as JSON

Types

type NotFoundHandler

type NotFoundHandler struct{}

NotFoundHandler deals with not found errors

func (*NotFoundHandler) ServeHTTP

func (err *NotFoundHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements HandleFunc for NotFoundHandler

type OAuthInfo

type OAuthInfo struct {
	Match util.StringSet
	Token *data.AccessToken
}

OAuthInfo provides information about an authorized access token

func OAuthToken

func OAuthToken(r *http.Request) (*OAuthInfo, bool)

OAuthToken gets an access token registered by an OAuthHandler.

Jump to

Keyboard shortcuts

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