Documentation ¶
Index ¶
- func Activation(w http.ResponseWriter, r *http.Request)
- func Approve(w http.ResponseWriter, r *http.Request)
- func ApprovePage(w http.ResponseWriter, r *http.Request)
- func Authorize(w http.ResponseWriter, r *http.Request)
- func CreateKey(w http.ResponseWriter, r *http.Request)
- func DeleteKey(w http.ResponseWriter, r *http.Request)
- func GetAccount(w http.ResponseWriter, r *http.Request)
- func GetKey(w http.ResponseWriter, r *http.Request)
- func ListAccountKeys(w http.ResponseWriter, r *http.Request)
- func ListAccounts(w http.ResponseWriter, r *http.Request)
- func LoginPage(w http.ResponseWriter, r *http.Request)
- func LoginWithCredentials(w http.ResponseWriter, r *http.Request)
- func LoginWithSession(w http.ResponseWriter, r *http.Request)
- func Logout(w http.ResponseWriter, r *http.Request)
- func OAuthHandler(scope ...string) func(http.Handler) http.Handler
- func OAuthHandlerPermissive() func(http.Handler) http.Handler
- func PrintErrorHTML(w http.ResponseWriter, r *http.Request, err interface{}, code int)
- func PrintErrorJSON(w http.ResponseWriter, r *http.Request, err interface{}, code int)
- func RegisterRoutes(r *mux.Router)
- func RegisteredPage(w http.ResponseWriter, r *http.Request)
- func RegistrationHandler(f func(string, string) bool) http.Handler
- func RegistrationInit(w http.ResponseWriter, r *http.Request)
- func RegistrationPage(w http.ResponseWriter, r *http.Request)
- func Reset(w http.ResponseWriter, r *http.Request)
- func ResetInit(w http.ResponseWriter, r *http.Request)
- func ResetInitPage(w http.ResponseWriter, r *http.Request)
- func ResetPage(w http.ResponseWriter, r *http.Request)
- func Token(w http.ResponseWriter, r *http.Request)
- func UpdateAccount(w http.ResponseWriter, r *http.Request)
- func UpdateAccountEmail(w http.ResponseWriter, r *http.Request)
- func UpdateAccountPassword(w http.ResponseWriter, r *http.Request)
- func Validate(w http.ResponseWriter, r *http.Request)
- type NotFoundHandler
- type OAuthInfo
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 ¶
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 ¶
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 ¶
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 ¶
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.
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