Documentation ¶
Overview ¶
Package github implements authentication provider implementation for authentication source GitHub.
Using GitHub as the authentication provider, this application can leverage both individual style accounts and organisational accounts with added support for organisation wide and team based authentication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessToken ¶
type AccessToken struct { Token string `json:"token"` Expire string `json:"expires_at"` Permissions interface{} `json:"permissions"` }
AccessToken defines the structure of Github response to access token request.
func (*AccessToken) AccessToken ¶
func (t *AccessToken) AccessToken(c Configuration)
AccessToken requests application access token from Github for authentication of the other calls
func (AccessToken) OrgMembers ¶
func (t AccessToken) OrgMembers(c Configuration, username string) *[]User
OrgMembers gets a list of members of the organisation according to the role
func (*AccessToken) TeamsMembers ¶
func (t *AccessToken) TeamsMembers(c Configuration, username string) *[]User
TeamsMembers gets a list of members of the given team according to the role
type Claims ¶
type Claims struct { jwt.StandardClaims Iss int `json:"iss"` }
Claims defines the override structure for the jwt.StandardClaims
func (*Claims) CreateToken ¶
CreateToken creates a signed JWT token that is used to request the access token
type Configuration ¶
type Configuration struct { InstallationId int `json:"installation_id"` AdminRole string `json:"admin_role"` ApiUrl string `json:"api_url"` DefaultRole string `json:"default_role"` Org string `json:"org"` TeamName string `json:"team_name"` MediaType string `json:"media_type"` Token string `json:"-"` }
Configuration defines the structure for the configuration needed to complete a query to Github API.
func (*Configuration) HttpCall ¶
func (c *Configuration) HttpCall(request *http.Request, response interface{}, statusCode int) error
HttpCall makes Http request for the given request and maps the response to given response pinter.
request defines the pointer for http.Request response defines the generic interface pointer to map the response statusCode defines the http status code to for successful response
type Team ¶
type Team struct { Name string `json:"name"` Id int `json:"id"` NodeId string `json:"node_id"` Slug string `json:"slug"` Description string `json:"description"` Privacy string `json:"privacy"` Url string `json:"url"` MembersUrl string `json:"members_url"` RepositoriesUrl string `json:"repositories_url"` Permission string `json:"permission"` }
Team defines the structure for the response of Github when requesting teams in an organisation.
func (*Team) GetTeam ¶
func (t *Team) GetTeam(c Configuration) error
GetTeam gets list of teams in the given organisation
type User ¶
type User struct { Login string `json:"login"` Id int `json:"id"` NodeId string `json:"node_id"` //AvatarUrl string `json:"avatar_url"` //GravatarId string `json:"gravatar_id"` Url string `json:"url"` HtmlUrl string `json:"html_url"` FollowersUrl string `json:"followers_url"` FollowingUrl string `json:"following_url"` GistsUrl string `json:"gists_url"` StarredUrl string `json:"starred_url"` SubscriptionsUrl string `json:"subscriptions_url"` OrganizationsUrl string `json:"organizations_url"` ReposUrl string `json:"repos_url"` EventsUrl string `json:"events_url"` ReceivedEventsUrl string `json:"received_events_url"` Type string `json:"type"` SiteAdmin bool `json:"site_admin"` }
User defines the structure for the response of Github when requesting user.
func (*User) UserKeys ¶
func (u *User) UserKeys(c Configuration) *[]Key
UserKeys gets keys on the user accounts given to the method