mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
fix(oauth): add a timeout to getOAuthToken() BE-11283 (#63)
This commit is contained in:
parent
e528cff615
commit
966fca950b
4 changed files with 44 additions and 61 deletions
|
@ -3,18 +3,16 @@ package oauth
|
|||
import (
|
||||
"errors"
|
||||
"strconv"
|
||||
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
)
|
||||
|
||||
func getUsername(datamap map[string]any, configuration *portainer.OAuthSettings) (string, error) {
|
||||
username, ok := datamap[configuration.UserIdentifier].(string)
|
||||
func GetUsername(datamap map[string]any, userIdentifier string) (string, error) {
|
||||
username, ok := datamap[userIdentifier].(string)
|
||||
if ok && username != "" {
|
||||
return username, nil
|
||||
}
|
||||
|
||||
if !ok {
|
||||
username, ok := datamap[configuration.UserIdentifier].(float64)
|
||||
username, ok := datamap[userIdentifier].(float64)
|
||||
if ok && username != 0 {
|
||||
return strconv.Itoa(int(username)), nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue