Documentation ¶
Overview ¶
Package phabricator provides methods for using OAuth2 to access Phabricator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config for OAuth.
func New ¶
New сreates a pointer to the structure Config that is required to work with OAuth
'phid' is the client is PHID https://phabricator.example.net/oauthserver/query/all/
'secret' is the application is secret available at the push of a button 'Show Application Secret'
'redirectURL' is the URL to redirect users going through the OAuth flow, after the resource owner's URLs.
'phabricatorURL' the url of the phabricator server that is the source of OAuth.
func (*Config) AuthCodeURL ¶
AuthCodeURL returns a URL to OAuth 2.0 provider's consent page that asks for permissions for the required scopes explicitly.
State is a token to protect the user from CSRF attacks. You must always provide a non-empty string and validate that it matches the state query parameter on your redirect callback. See http://tools.ietf.org/html/rfc6749#section-10.12 for more info.
func (*Config) Authenticate ¶
Authenticate returns the structure of the User, by code. The code will be in the *http.Request.FormValue("code") https://secure.phabricator.com/book/phabcontrib/article/using_oauthserver/
type User ¶
type User struct { PHID string `json:"phid"` UserName string `json:"userName"` RealName string `json:"realName"` Image string `json:"image"` URI string `json:"uri"` Roles []string `json:"roles"` PrimaryEmail string `json:"primaryEmail"` }
User is the result of the function JSON looks like:
{ "phid": "PHID-USER-...", "userName": "...", "realName": "...", "image": phabricator_user_picture, "uri": phabricator_user_url, "roles": ["admin", "verified", "approved", "activated"], "primaryEmail": email }