mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
SSCT Tokens Feature [OSS] (#14109)
* port SSCT OSS * port header hmac key to ent and generate token proto without make command * remove extra nil check in request handling * add changelog * add comment to router.go * change test var to use length constants * remove local index is 0 check and extra defer which can be removed after use of ExternalID
This commit is contained in:
@@ -64,6 +64,12 @@ func handleSysGenerateRootAttemptGet(core *vault.Core, w http.ResponseWriter, r
|
||||
respondError(w, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
var otpLength int
|
||||
if core.DisableSSCTokens() {
|
||||
otpLength = vault.TokenLength + vault.OldTokenPrefixLength
|
||||
} else {
|
||||
otpLength = vault.TokenLength + vault.TokenPrefixLength
|
||||
}
|
||||
|
||||
// Format the status
|
||||
status := &GenerateRootStatusResponse{
|
||||
@@ -71,7 +77,7 @@ func handleSysGenerateRootAttemptGet(core *vault.Core, w http.ResponseWriter, r
|
||||
Progress: progress,
|
||||
Required: sealConfig.SecretThreshold,
|
||||
Complete: false,
|
||||
OTPLength: vault.TokenLength + 2,
|
||||
OTPLength: otpLength,
|
||||
OTP: otp,
|
||||
}
|
||||
if generationConfig != nil {
|
||||
@@ -98,7 +104,11 @@ func handleSysGenerateRootAttemptPut(core *vault.Core, w http.ResponseWriter, r
|
||||
case len(req.PGPKey) > 0, len(req.OTP) > 0:
|
||||
default:
|
||||
genned = true
|
||||
req.OTP, err = base62.Random(vault.TokenLength + 2)
|
||||
if core.DisableSSCTokens() {
|
||||
req.OTP, err = base62.Random(vault.TokenLength + vault.OldTokenPrefixLength)
|
||||
} else {
|
||||
req.OTP, err = base62.Random(vault.TokenLength + vault.TokenPrefixLength)
|
||||
}
|
||||
if err != nil {
|
||||
respondError(w, http.StatusInternalServerError, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user