summaryrefslogtreecommitdiffstats
path: root/services/auth
diff options
context:
space:
mode:
Diffstat (limited to 'services/auth')
-rw-r--r--services/auth/basic.go5
-rw-r--r--services/auth/reverseproxy.go5
2 files changed, 8 insertions, 2 deletions
diff --git a/services/auth/basic.go b/services/auth/basic.go
index d7f889cbdc..9cfbd0f644 100644
--- a/services/auth/basic.go
+++ b/services/auth/basic.go
@@ -23,6 +23,9 @@ var (
_ Named = &Basic{}
)
+// BasicMethodName is the constant name of the basic authentication method
+const BasicMethodName = "basic"
+
// Basic implements the Auth interface and authenticates requests (API requests
// only) by looking for Basic authentication data or "x-oauth-basic" token in the "Authorization"
// header.
@@ -31,7 +34,7 @@ type Basic struct {
// Name represents the name of auth method
func (b *Basic) Name() string {
- return "basic"
+ return BasicMethodName
}
// Verify extracts and validates Basic data (username and password/token) from the
diff --git a/services/auth/reverseproxy.go b/services/auth/reverseproxy.go
index 550fcabc1d..7cd24c302d 100644
--- a/services/auth/reverseproxy.go
+++ b/services/auth/reverseproxy.go
@@ -24,6 +24,9 @@ var (
_ Named = &ReverseProxy{}
)
+// ReverseProxyMethodName is the constant name of the ReverseProxy authentication method
+const ReverseProxyMethodName = "reverse_proxy"
+
// ReverseProxy implements the Auth interface, but actually relies on
// a reverse proxy for authentication of users.
// On successful authentication the proxy is expected to populate the username in the
@@ -43,7 +46,7 @@ func (r *ReverseProxy) getUserName(req *http.Request) string {
// Name represents the name of auth method
func (r *ReverseProxy) Name() string {
- return "reverse_proxy"
+ return ReverseProxyMethodName
}
// Verify extracts the username from the "setting.ReverseProxyAuthUser" header