mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
sr: use service account cred for claims check (#19209)
PR #19111 overlaid service account secret with site replicator secret during token claims check. Fixes : #19206
This commit is contained in:
parent
e91a4a414c
commit
837a2a3d4b
@ -300,19 +300,21 @@ func checkClaimsFromToken(r *http.Request, cred auth.Credentials) (map[string]in
|
||||
}
|
||||
|
||||
secret := globalActiveCred.SecretKey
|
||||
var err error
|
||||
if globalSiteReplicationSys.isEnabled() && cred.AccessKey != siteReplicatorSvcAcc {
|
||||
if cred.ParentUser != globalActiveCred.AccessKey {
|
||||
secret, err = getTokenSigningKey()
|
||||
if err != nil {
|
||||
return nil, toAPIErrorCode(r.Context(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
if cred.IsServiceAccount() {
|
||||
token = cred.SessionToken
|
||||
secret = cred.SecretKey
|
||||
}
|
||||
|
||||
if token != "" {
|
||||
var err error
|
||||
if globalSiteReplicationSys.isEnabled() && cred.AccessKey != siteReplicatorSvcAcc {
|
||||
secret, err = getTokenSigningKey()
|
||||
if err != nil {
|
||||
return nil, toAPIErrorCode(r.Context(), err)
|
||||
}
|
||||
}
|
||||
claims, err := getClaimsFromTokenWithSecret(token, secret)
|
||||
if err != nil {
|
||||
return nil, toAPIErrorCode(r.Context(), err)
|
||||
|
@ -164,8 +164,21 @@ if [ $? -ne 0 ]; then
|
||||
exit_1
|
||||
fi
|
||||
|
||||
./mc admin user svcacct add minio2 minio --access-key testsvc2 --secret-key testsvc123
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "adding root svc account testsvc2 failed, exiting.."
|
||||
exit_1
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
|
||||
export MC_HOST_rootsvc=http://testsvc2:testsvc123@localhost:9002
|
||||
./mc ls rootsvc
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "root service account not inherited root permissions, exiting.."
|
||||
exit_1
|
||||
fi
|
||||
|
||||
./mc admin user svcacct info minio1 testsvc
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "svc account not mirrored, exiting.."
|
||||
|
Loading…
Reference in New Issue
Block a user