code.gitea.io/gitea@v1.21.7/services/auth/sspiauth_posix.go (about)

     1  // Copyright 2023 The Gitea Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  //go:build !windows
     5  
     6  package auth
     7  
     8  import (
     9  	"errors"
    10  	"net/http"
    11  )
    12  
    13  type SSPIUserInfo struct {
    14  	Username string   // Name of user, usually in the form DOMAIN\User
    15  	Groups   []string // The global groups the user is a member of
    16  }
    17  
    18  type sspiAuthMock struct{}
    19  
    20  func (s sspiAuthMock) AppendAuthenticateHeader(w http.ResponseWriter, data string) {
    21  }
    22  
    23  func (s sspiAuthMock) Authenticate(r *http.Request, w http.ResponseWriter) (userInfo *SSPIUserInfo, outToken string, err error) {
    24  	return nil, "", errors.New("not implemented")
    25  }
    26  
    27  func sspiAuthInit() error {
    28  	sspiAuth = &sspiAuthMock{} // TODO: we can mock the SSPI auth in tests
    29  	return nil
    30  }