diff options
author | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-06-24 10:22:17 +0200 |
---|---|---|
committer | Quentin Dufour <quentin@deuxfleurs.fr> | 2024-06-24 10:22:17 +0200 |
commit | e940996f0f8cb8c6adb22c7d8780e364d65ecea2 (patch) | |
tree | 7cdc6db520293ea1623b07fd68eff6a595d0e0e3 /login.go | |
parent | a7edf6d1ba812f11b7711c4bdc6dc6d9af9c7906 (diff) | |
download | guichet-e940996f0f8cb8c6adb22c7d8780e364d65ecea2.tar.gz guichet-e940996f0f8cb8c6adb22c7d8780e364d65ecea2.zip |
generate a per-website dedicated key
Diffstat (limited to 'login.go')
-rw-r--r-- | login.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -143,6 +143,7 @@ func NewCapabilities(login *LoginStatus, entry *ldap.Entry) *Capabilities { // --- Logged User --- type LoggedUser struct { + Username string Login *LoginStatus Entry *ldap.Entry Capabilities *Capabilities @@ -186,7 +187,9 @@ func NewLoggedUser(login *LoginStatus) (*LoggedUser, error) { } entry := sr.Entries[0] + username := login.Info.Username lu := &LoggedUser{ + Username: username, Login: login, Entry: entry, Capabilities: NewCapabilities(login, entry), @@ -204,6 +207,7 @@ func (lu *LoggedUser) WelcomeName() string { } return ret } + func (lu *LoggedUser) S3KeyInfo() (*garage.KeyInfo, error) { var err error var keyPair *garage.KeyInfo @@ -212,7 +216,7 @@ func (lu *LoggedUser) S3KeyInfo() (*garage.KeyInfo, error) { keyID := lu.Entry.GetAttributeValue("garage_s3_access_key") if keyID == "" { // If there is no S3Key in LDAP, generate it... - keyPair, err = grgCreateKey(lu.Login.Info.Username) + keyPair, err = grgCreateKey(lu.Username) if err != nil { return nil, err } |