aboutsummaryrefslogtreecommitdiff
path: root/login.go
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-06-24 10:22:17 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-06-24 10:22:17 +0200
commite940996f0f8cb8c6adb22c7d8780e364d65ecea2 (patch)
tree7cdc6db520293ea1623b07fd68eff6a595d0e0e3 /login.go
parenta7edf6d1ba812f11b7711c4bdc6dc6d9af9c7906 (diff)
downloadguichet-e940996f0f8cb8c6adb22c7d8780e364d65ecea2.tar.gz
guichet-e940996f0f8cb8c6adb22c7d8780e364d65ecea2.zip
generate a per-website dedicated key
Diffstat (limited to 'login.go')
-rw-r--r--login.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/login.go b/login.go
index 4bbcd65..a2c7d8f 100644
--- a/login.go
+++ b/login.go
@@ -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
}