Documentation
¶
Index ¶
- type App
- type Connection
- type Oauth2
- type Token
- func (h Token) Create(w http.ResponseWriter, r *http.Request)
- func (h Token) Destroy(w http.ResponseWriter, r *http.Request)
- func (h Token) Edit(w http.ResponseWriter, r *http.Request)
- func (h Token) Index(w http.ResponseWriter, r *http.Request)
- func (h Token) Store(w http.ResponseWriter, r *http.Request)
- func (h Token) Update(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
App handles serving responses to managing an OAuth app that a user has created for OAuth access to the API.
func (App) Create ¶
func (h App) Create(w http.ResponseWriter, r *http.Request)
Create serves the HTML response for creating a new OAuth app.
func (App) Index ¶
func (h App) Index(w http.ResponseWriter, r *http.Request)
Index serves the HTML response detailing the list of OAuth apps for the current user.
func (App) Show ¶
func (h App) Show(w http.ResponseWriter, r *http.Request)
Show serves the individual HTML response for viewing an individual OAuth app.
func (App) Store ¶
func (h App) Store(w http.ResponseWriter, r *http.Request)
Store validates the form submitted in the given request for creating an OAuth app. If validation fails then the user is redirected back to the request referer, otherwise they are redirect back to the OAuth app index.
func (App) Update ¶
func (h App) Update(w http.ResponseWriter, r *http.Request)
Update validates the form submitted in the given request for updating an OAuth app. If validation fails then the user is redirect back to the request's referer, otherwise they are redirected back to the updated OAuth app. If the base of the requested URL path is "/revoke" then this will revoke all of the access tokens for this app. If the base of the path is "/reset" then it will generate a new client secret.
type Connection ¶
Connection handles serving the responses to managing the OAuth apps that have connected to a user's account.
func NewConnection ¶
func NewConnection(h web.Handler) Connection
func (Connection) Destroy ¶
func (h Connection) Destroy(w http.ResponseWriter, r *http.Request)
Destroy will delete the connection from the user's account. This will delete the underlying access token that was generated for the user from the database.
func (Connection) Index ¶
func (h Connection) Index(w http.ResponseWriter, r *http.Request)
Index serves the HTML response detailing the list of connected apps.
func (Connection) Show ¶
func (h Connection) Show(w http.ResponseWriter, r *http.Request)
Show serves the HTML response detailing an individual connected app.
type Oauth2 ¶
Oauth2 is the handler that handles the OAuth token webflow.
func (Oauth2) Auth ¶
func (h Oauth2) Auth(w http.ResponseWriter, r *http.Request)
Auth will either serve up the OAuth login page on a GET request, or process the submitted form on a POST request. If the user has already granted access to the OAuth app then nothing happens, and they are simply redirected back to the app's redirect URL. If any scopes changed, then the original access token generated for the user (if any) is updated with the new scopes.
func (Oauth2) Revoke ¶
func (h Oauth2) Revoke(w http.ResponseWriter, r *http.Request)
Revoke revokes the OAuth token in the given request header.
func (Oauth2) Token ¶
func (h Oauth2) Token(w http.ResponseWriter, r *http.Request)
Token will serve the JSON encoded access token for the user that granted access to an OAuth app. This uses the OAuth code submitted in the request as a means of authentication. If the submitted code has not expired then the token is created, and returned in the response. The tokens generated do not expire.
type Token ¶
Token handles serving responses for managing personal access tokens that a user creates to access the API.
func (Token) Create ¶
func (h Token) Create(w http.ResponseWriter, r *http.Request)
Create serves the HTML response for creating a new personal access token.
func (Token) Destroy ¶
func (h Token) Destroy(w http.ResponseWriter, r *http.Request)
Destroy removes the token in the request from the database.
func (Token) Edit ¶
func (h Token) Edit(w http.ResponseWriter, r *http.Request)
Edit serves the HTML response for editing a personal access token.
func (Token) Index ¶
func (h Token) Index(w http.ResponseWriter, r *http.Request)
Index serves the HTML response detailing the list of personal access tokens created for the current user.
func (Token) Store ¶
func (h Token) Store(w http.ResponseWriter, r *http.Request)
Store validates the form submitted in the given request for creating a personal access token. If validation fails then the user is redirected back to the request referer, otherwise they are redirect back to the token index. If no specific scopes are specified in the form submission, then all scopes are added to the created token.
func (Token) Update ¶
func (h Token) Update(w http.ResponseWriter, r *http.Request)
Update validates the form submitted in the given request for updating token. If validation fails then the user is redirect back to the request's referer, otherwise they are redirected back to the token index. If the base path of the request URL is "/regenerate", then the token is simply regenerated.