@@ -32,10 +32,10 @@ var (
3232 sspiAuth * websspi.Authenticator
3333
3434 // Ensure the struct implements the interface.
35- _ Auth = & SSPI {}
35+ _ SingleSignOn = & SSPI {}
3636)
3737
38- // SSPI implements the Auth interface and authenticates requests
38+ // SSPI implements the SingleSignOn interface and authenticates requests
3939// via the built-in SSPI module in Windows for SPNEGO authentication.
4040// On successful authentication returns a valid user object.
4141// Returns nil if authentication fails.
@@ -72,16 +72,11 @@ func (s *SSPI) Free() error {
7272 return sspiAuth .Free ()
7373}
7474
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.
8176// If authentication is successful, returs the corresponding user object.
8277// If negotiation should continue or authentication fails, immediately returns a 401 HTTP
8378// 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 {
8580 if ! s .shouldAuthenticate (req ) {
8681 return nil
8782 }
@@ -240,10 +235,12 @@ func sanitizeUsername(username string, cfg *models.SSPIConfig) string {
240235 return username
241236}
242237
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.
244239// The SSPI plugin is expected to be executed last, as it returns 401 status code if negotiation
245240// fails (or if negotiation should continue), which would prevent other authentication methods
246241// to execute at all.
247- func init () {
248- Register (& SSPI {})
242+ func specialInit () {
243+ if models .IsSSPIEnabled () {
244+ Register (& SSPI {})
245+ }
249246}
0 commit comments