28 lines
698 B
Go
28 lines
698 B
Go
package http
|
|
|
|
import "forge.cadoles.com/arcad/edge/pkg/module/auth/http/passwd"
|
|
|
|
type LocalAccount struct {
|
|
Username string `json:"username"`
|
|
Algo passwd.Algo `json:"algo"`
|
|
Password string `json:"password"`
|
|
Claims map[string]any `json:"claims"`
|
|
}
|
|
|
|
func NewLocalAccount(username, password string, algo passwd.Algo, claims map[string]any) LocalAccount {
|
|
return LocalAccount{
|
|
Username: username,
|
|
Password: password,
|
|
Algo: algo,
|
|
Claims: claims,
|
|
}
|
|
}
|
|
|
|
func toAccountsMap(accounts []LocalAccount) map[string]LocalAccount {
|
|
accountsMap := make(map[string]LocalAccount)
|
|
for _, acc := range accounts {
|
|
accountsMap[acc.Username] = acc
|
|
}
|
|
return accountsMap
|
|
}
|