@@ -32,10 +32,10 @@ var (
32
32
sspiAuth * websspi.Authenticator
33
33
34
34
// Ensure the struct implements the interface.
35
- _ Auth = & SSPI {}
35
+ _ SingleSignOn = & SSPI {}
36
36
)
37
37
38
- // SSPI implements the Auth interface and authenticates requests
38
+ // SSPI implements the SingleSignOn interface and authenticates requests
39
39
// via the built-in SSPI module in Windows for SPNEGO authentication.
40
40
// On successful authentication returns a valid user object.
41
41
// Returns nil if authentication fails.
@@ -72,16 +72,11 @@ func (s *SSPI) Free() error {
72
72
return sspiAuth .Free ()
73
73
}
74
74
75
- // IsEnabled checks if there is an active SSPI authentication source
76
- func (s * SSPI ) IsEnabled () bool {
77
- return models .IsSSPIEnabled ()
78
- }
79
-
80
- // VerifyAuthData uses SSPI (Windows implementation of SPNEGO) to authenticate the request.
75
+ // Verify uses SSPI (Windows implementation of SPNEGO) to authenticate the request.
81
76
// If authentication is successful, returs the corresponding user object.
82
77
// If negotiation should continue or authentication fails, immediately returns a 401 HTTP
83
78
// response code, as required by the SPNEGO protocol.
84
- func (s * SSPI ) VerifyAuthData (req * http.Request , w http.ResponseWriter , store DataStore , sess SessionStore ) * models.User {
79
+ func (s * SSPI ) Verify (req * http.Request , w http.ResponseWriter , store DataStore , sess SessionStore ) * models.User {
85
80
if ! s .shouldAuthenticate (req ) {
86
81
return nil
87
82
}
@@ -240,10 +235,12 @@ func sanitizeUsername(username string, cfg *models.SSPIConfig) string {
240
235
return username
241
236
}
242
237
243
- // init registers the SSPI auth method as the last method in the list.
238
+ // specialInit registers the SSPI auth method as the last method in the list.
244
239
// The SSPI plugin is expected to be executed last, as it returns 401 status code if negotiation
245
240
// fails (or if negotiation should continue), which would prevent other authentication methods
246
241
// to execute at all.
247
- func init () {
248
- Register (& SSPI {})
242
+ func specialInit () {
243
+ if models .IsSSPIEnabled () {
244
+ Register (& SSPI {})
245
+ }
249
246
}
0 commit comments