Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerzal committed Nov 5, 2024
1 parent 42b4cfb commit 77d3ec8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ linters:
linters-settings:
misspell:
locale: US
golint:
min-confidence: 0
govet:
check-shadowing: false
goimports:
local-prefixes: github.com/Nerzal/gocloak
gocognit:
Expand Down
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func makeURL(path ...string) string {
func (g *GoCloak) compareVersions(v, token string, ctx context.Context) (int, error) {

Check failure on line 66 in client.go

View workflow job for this annotation

GitHub Actions / tests

context-as-argument: context.Context should be the first parameter of a function (revive)

Check failure on line 66 in client.go

View workflow job for this annotation

GitHub Actions / tests

context-as-argument: context.Context should be the first parameter of a function (revive)
curVersion := g.Config.version
if curVersion == "" {
curV, err := g.getServerVersion(ctx, token);
curV, err := g.getServerVersion(ctx, token)
if err != nil {
return 0, err
}
Expand All @@ -75,7 +75,7 @@ func (g *GoCloak) compareVersions(v, token string, ctx context.Context) (int, er
}

curVersion = "v" + g.Config.version
if (v[0] != 'v') {
if v[0] != 'v' {
v = "v" + v
}

Expand Down Expand Up @@ -777,7 +777,7 @@ func (g *GoCloak) ExecuteActionsEmail(ctx context.Context, token, realm string,

// SendVerifyEmail sends a verification e-mail to a user.
func (g *GoCloak) SendVerifyEmail(ctx context.Context, token, userID, realm string, params ...SendVerificationMailParams) error {
const errMessage = "could not execute actions email"
const errMessage = "failed to send verify email"

queryParams := map[string]string{}
if params != nil {
Expand Down
18 changes: 8 additions & 10 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2639,7 +2639,7 @@ func Test_SendVerifyEmail(t *testing.T) {
cfg.GoCloak.Realm,
params)
if err != nil {
if err.Error() == "500 Internal Server Error: Failed to send verify email" {
if err.Error() == "500 Internal Server Error: Failed to send execute actions email" {
return
}
require.NoError(t, err, "SendVerifyEmail failed")
Expand Down Expand Up @@ -6641,14 +6641,13 @@ func Test_ImportIdentityProviderConfig(t *testing.T) {
require.NoError(t, err, "ImportIdentityProviderConfig failed")

expected := map[string]string{
"userInfoUrl": "https://openidconnect.googleapis.com/v1/userinfo",
"validateSignature": "true",
"tokenUrl": "https://oauth2.googleapis.com/token",
"authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth",
"jwksUrl": "https://www.googleapis.com/oauth2/v3/certs",
"issuer": "https://accounts.google.com",
"useJwksUrl": "true",
"metadataDescriptorUrl": "https://accounts.google.com/.well-known/openid-configuration",
"userInfoUrl": "https://openidconnect.googleapis.com/v1/userinfo",
"validateSignature": "true",
"tokenUrl": "https://oauth2.googleapis.com/token",
"authorizationUrl": "https://accounts.google.com/o/oauth2/v2/auth",
"jwksUrl": "https://www.googleapis.com/oauth2/v3/certs",
"issuer": "https://accounts.google.com",
"useJwksUrl": "true",
}

require.Len(
Expand Down Expand Up @@ -6723,7 +6722,6 @@ E8go1LcvbfHNyknHu2sptnRq55fHZSHr18vVsQRfDYMG</ds:X509Certificate>
"loginHint": "false",
"enabledFromMetadata": "true",
"idpEntityId": "https://accounts.google.com/o/saml2?idpid=C01unc9st",
"syncMode": "LEGACY",
}

require.Len(
Expand Down
11 changes: 11 additions & 0 deletions gocloak_iface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 77d3ec8

Please sign in to comment.