Skip to content

Commit

Permalink
Refactor client secret validation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ShocOne committed Feb 9, 2024
1 parent 8314507 commit 87c958e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions httpclient/httpclient_authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ func IsValidClientSecret(clientSecret string) (bool, string) {
if len(clientSecret) < 16 {
return false, "Client secret must be at least 16 characters long."
}

// Check if the client secret contains at least one lowercase letter, one uppercase letter, one digit, and one special character.
complexityRegex := `^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[\W_]).+$`
if matched, _ := regexp.MatchString(complexityRegex, clientSecret); matched {
if regexp.MustCompile(complexityRegex).MatchString(clientSecret) {
return true, ""
}
return false, "Client secret must contain at least one lowercase letter, one uppercase letter, one digit, and one special character."
Expand Down

0 comments on commit 87c958e

Please sign in to comment.