forked from loft-sh/vcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vcluster license initalization / loader refactor (loft-sh#2320)
* adjust license pro functions to the changes made in the vcluster-pro refactor Signed-off-by: Paweł Bojanowski <[email protected]> * return error from license.Init Signed-off-by: Paweł Bojanowski <[email protected]> * refactor: use delegate for platform authentication --------- Signed-off-by: Paweł Bojanowski <[email protected]> Co-authored-by: Fabian Kramm <[email protected]>
- Loading branch information
1 parent
4f11a08
commit 1484731
Showing
5 changed files
with
54 additions
and
32 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
36 changes: 36 additions & 0 deletions
36
pkg/authentication/platformauthenticator/platformauthenticator.go
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,36 @@ | ||
package platformauthenticator | ||
|
||
import ( | ||
"net/http" | ||
"sync" | ||
|
||
"k8s.io/apiserver/pkg/authentication/authenticator" | ||
) | ||
|
||
var Default = &PlatformAuthenticator{} | ||
|
||
var _ authenticator.Request = &PlatformAuthenticator{} | ||
|
||
type PlatformAuthenticator struct { | ||
m sync.RWMutex | ||
|
||
delegate authenticator.Request | ||
} | ||
|
||
func (p *PlatformAuthenticator) SetDelegate(delegate authenticator.Request) { | ||
p.m.Lock() | ||
defer p.m.Unlock() | ||
|
||
p.delegate = delegate | ||
} | ||
|
||
func (p *PlatformAuthenticator) AuthenticateRequest(req *http.Request) (*authenticator.Response, bool, error) { | ||
p.m.RLock() | ||
defer p.m.RUnlock() | ||
|
||
if p.delegate == nil { | ||
return nil, false, nil | ||
} | ||
|
||
return p.delegate.AuthenticateRequest(req) | ||
} |
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 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