-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e481638
commit face41c
Showing
9 changed files
with
68 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2023 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
//go:build !windows | ||
|
||
package auth | ||
|
||
import ( | ||
"errors" | ||
"net/http" | ||
) | ||
|
||
type UserInfo struct { | ||
Username string // Name of user, usually in the form DOMAIN\User | ||
Groups []string // The global groups the user is a member of | ||
} | ||
|
||
type sspiAuthMock struct{} | ||
|
||
func (s sspiAuthMock) AppendAuthenticateHeader(w http.ResponseWriter, data string) { | ||
} | ||
|
||
func (s sspiAuthMock) Authenticate(r *http.Request, w http.ResponseWriter) (userInfo *UserInfo, outToken string, err error) { | ||
return nil, "", errors.New("not implemented") | ||
} | ||
|
||
func sspiAuthInit() { | ||
sspiAuth = &sspiAuthMock{} // TODO: we can mock the SSPI auth in tests | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2023 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
//go:build windows | ||
|
||
package auth | ||
|
||
import ( | ||
"github.com/quasoft/websspi" | ||
) | ||
|
||
type UserInfo = websspi.UserInfo | ||
|
||
func sspiAuthInit() { | ||
var err error | ||
config := websspi.NewConfig() | ||
if sspiAuth, err = websspi.New(config); err != nil { | ||
panic(err) // this init is called by a sync.Once, maybe "panic" is the simplest way to handle errors | ||
} | ||
} |