10 tokenTypeBearer = "Bearer"
11 tokenTypeToken = "token"
13 acceptHeader = "Accept"
14 acceptApplicationJSON = "application/json"
17func makeAuthorizationHeader(prefix, token string, extraHeaders map[string]string) http.Header {
18 header := make(http.Header)
19 for key, value := range extraHeaders {
20 header.Add(key, value)
22 header.Set("Authorization", fmt.Sprintf("%s %s", prefix, token))
26func makeOIDCHeader(accessToken string) http.Header {
27 // extra headers required by the IDP when making authenticated requests
28 extraHeaders := map[string]string{
29 acceptHeader: acceptApplicationJSON,
31 return makeAuthorizationHeader(tokenTypeBearer, accessToken, extraHeaders)
34func makeLoginURL(p *ProviderData, redirectURI, state string, extraParams url.Values) url.URL {
36 params, _ := url.ParseQuery(a.RawQuery)
37 params.Set("redirect_uri", redirectURI)
38 if p.AcrValues != "" {
39 params.Add("acr_values", p.AcrValues)
42 params.Set("prompt", p.Prompt)
43 } else { // Legacy variant of the prompt param:
44 params.Set("approval_prompt", p.ApprovalPrompt)
46 params.Add("scope", p.Scope)
47 params.Set("client_id", p.ClientID)
48 params.Set("response_type", "code")
49 params.Add("state", state)
50 for n, p := range extraParams {
55 a.RawQuery = params.Encode()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list