forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
urls.go
37 lines (32 loc) · 1.04 KB
/
urls.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package urls
import (
"path"
"strings"
)
const (
AuthorizePath = "/authorize"
TokenPath = "/token"
InfoPath = "/info"
RequestTokenEndpoint = "/token/request"
DisplayTokenEndpoint = "/token/display"
ImplicitTokenEndpoint = "/token/implicit"
)
const OpenShiftOAuthAPIPrefix = "/oauth"
func OpenShiftOAuthAuthorizeURL(masterAddr string) string {
return openShiftOAuthURL(masterAddr, AuthorizePath)
}
func OpenShiftOAuthTokenURL(masterAddr string) string {
return openShiftOAuthURL(masterAddr, TokenPath)
}
func OpenShiftOAuthTokenRequestURL(masterAddr string) string {
return openShiftOAuthURL(masterAddr, RequestTokenEndpoint)
}
func OpenShiftOAuthTokenDisplayURL(masterAddr string) string {
return openShiftOAuthURL(masterAddr, DisplayTokenEndpoint)
}
func OpenShiftOAuthTokenImplicitURL(masterAddr string) string {
return openShiftOAuthURL(masterAddr, ImplicitTokenEndpoint)
}
func openShiftOAuthURL(masterAddr, oauthEndpoint string) string {
return strings.TrimRight(masterAddr, "/") + path.Join(OpenShiftOAuthAPIPrefix, oauthEndpoint)
}