Documentation ¶
Index ¶
- Constants
- Variables
- func AddAutomaticRoleGrants(id string, email string) error
- func AddUserRole(id string, role string) error
- func ConstructSafeURL(scheme string, host string, path string, queryParams map[string]string) (string, error)
- func ConstructURLQuery(u *url.URL, params map[string]string)
- func GetAuthorizeRedirect(provider string, redirect_uri string) (string, error)
- func GetEmail(oauth_token string, provider string) (string, bool, error)
- func GetFirstName(oauth_token string, provider string) (string, error)
- func GetGithubEmail(oauth_token string) (string, bool, error)
- func GetGithubName(oauth_token string) (string, error)
- func GetGithubOauthToken(code string) (string, error)
- func GetGithubUniqueId(oauth_token string) (string, error)
- func GetGithubUsername(oauth_token string) (string, error)
- func GetGoogleEmail(oauth_token string) (string, bool, error)
- func GetGoogleFirstName(oauth_token string) (string, error)
- func GetGoogleLastName(oauth_token string) (string, error)
- func GetGoogleOauthToken(code string, redirect_uri string) (string, error)
- func GetGoogleUniqueId(oauth_token string) (string, error)
- func GetGoogleUsername(oauth_token string) (string, error)
- func GetLastName(oauth_token string, provider string) (string, error)
- func GetLinkedinEmail(oauth_token string) (string, bool, error)
- func GetLinkedinFirstName(oauth_token string) (string, error)
- func GetLinkedinLastName(oauth_token string) (string, error)
- func GetLinkedinOauthToken(code string, redirect_uri string) (string, error)
- func GetLinkedinUniqueId(oauth_token string) (string, error)
- func GetLinkedinUsername(oauth_token string) (string, error)
- func GetOauthToken(code string, provider string, redirect_uri string) (string, error)
- func GetUniqueId(oauth_token string, provider string) (string, error)
- func GetUserInfo(id string) (*models.UserInfo, error)
- func GetUserRoles(id string, create_user bool) ([]string, error)
- func GetUsername(oauth_token string, provider string) (string, error)
- func MakeToken(id string, email string, roles []string) (string, error)
- func RemoveUserRole(id string, role string) error
- func SendUserInfo(id string, username string, first_name string, last_name string, email string) error
Constants ¶
const LINKEDIN_USER_INFO_URL = "https://api.linkedin.com/v1/people/~:(id,formatted-name,email-address,first-name,last-name)"
Variables ¶
var HASHTAG_INVALID_ERR = errors.New("`#` is an invalid character")
Functions ¶
func AddAutomaticRoleGrants ¶
Automatically grant staff and admin roles based on user's verified email
func AddUserRole ¶
Adds a role to the user with the specified id
func ConstructSafeURL ¶
func ConstructSafeURL(scheme string, host string, path string, queryParams map[string]string) (string, error)
This function takes in the ingredients to a URL and outputs a string of them all together. It also checks for the appearance of "#" anywhere in the query params and throws an error if it is there. queryParams is an optional param. nil can be passed in if the url needs no query params.
func ConstructURLQuery ¶
A helper function that takes a URL pointer and a map of query params->values, and modifies the URL's RawQuery property with the supplied query params.
func GetAuthorizeRedirect ¶
Return the oauth authorization url for the given provider
func GetFirstName ¶
Gets the user's first name from the specified oauth provider
func GetGithubEmail ¶
Uses a valid oauth token to get the user's primary email
func GetGithubName ¶
Uses a valid oauth token to get the user's name
func GetGithubOauthToken ¶
Uses a valid oauth code to get a valid oauth token for the user
func GetGithubUniqueId ¶
Uses a valid oauth token to get the user's unique id
func GetGithubUsername ¶
Uses a valid oauth token to get the user's username
func GetGoogleEmail ¶
Uses a valid oauth token to get the user's primary email
func GetGoogleFirstName ¶
Uses a valid oauth token to get the user's first name
func GetGoogleLastName ¶
Uses a valid oauth token to get the user's last name
func GetGoogleOauthToken ¶
Uses a valid oauth code to get a valid oauth token for the user
func GetGoogleUniqueId ¶
Uses a valid oauth token to get the user's unique id
func GetGoogleUsername ¶
Uses a valid oauth token to get the user's username
func GetLastName ¶
Gets the user's last name from the specified oauth provider
func GetLinkedinEmail ¶
Uses a valid OAuth token to get the user's primary email.
func GetLinkedinFirstName ¶
Uses a valid OAuth token to get the user's name.
func GetLinkedinLastName ¶
Uses a valid OAuth token to get the user's last name.
func GetLinkedinOauthToken ¶
Uses a valid OAuth authorization code to get a valid OAuth token for the user.
func GetLinkedinUniqueId ¶
Uses a valid OAuth token to get the user's unique id.
func GetLinkedinUsername ¶
Uses a valid OAuth token to get the user's username.
func GetOauthToken ¶
Converts an oauth code to an oauth token for the specified provider
func GetUniqueId ¶
Gets the user's unique id from the specified oauth provider
func GetUserInfo ¶
Given a user ID, fetch the user info corresponding to the ID.
func GetUserRoles ¶
Get the user's roles by id If the user has no roles and create_user is true they will be assigned the role User This generally occurs the first time the user logs into the service
func GetUsername ¶
Gets the user's username from the specified oauth provider
func MakeToken ¶
Generates a signed oauth token with the user's id, email, and roles embedded in the claims
func RemoveUserRole ¶
Removes a role from the user with the specified id
Types ¶
This section is empty.