Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,41 @@ jobs:
uses: golangci/golangci-lint-action@v6.1.0
- name: WriteGoList
run: go list -json -m all > go.list
- name: nancy
uses: sonatype-nexus-community/nancy-github-action@main
- name: Run Keycloak
run: |
make start-keycloak
sleep 15
- name: Unit Tests
run: |
go test -failfast -race -cover -coverprofile=coverage.txt -covermode=atomic -p 100 -cpu 1,2 -bench . -benchmem > test.log
cat test.log
- name: Failed Logs
if: failure()
run: |
cat test.log
docker ps
docker logs keycloak
- name: CodeCov
uses: codecov/codecov-action@v4.5.0
with:
file: ./coverage.txt
# - name: nancy
# uses: sonatype-nexus-community/nancy-github-action@main
# - name: Run Keycloak
# run: |
# make start-keycloak
# sleep 15
# - name: Unit Tests
# run: |
# go test -failfast -race -cover -coverprofile=coverage.txt -covermode=atomic -p 100 -cpu 1,2 -bench . -benchmem > test.log
# cat test.log
# - name: Failed Logs
# if: failure()
# run: |
# cat test.log
# docker ps
# docker logs keycloak
# - name: CodeCov
# uses: codecov/codecov-action@v4.5.0
# with:
# file: ./coverage.txt

# Publish benchmarks for the main branch only
- name: Store Benchmark Result
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: rhysd/github-action-benchmark@v1.20.3
with:
# What benchmark tool the output.txt came from
tool: "go"
# Where the output from the benchmark tool is stored
output-file-path: test.log
# Push and deploy GitHub pages branch automatically
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
# # Publish benchmarks for the main branch only
# - name: Store Benchmark Result
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# uses: rhysd/github-action-benchmark@v1.20.3
# with:
# # What benchmark tool the output.txt came from
# tool: "go"
# # Where the output from the benchmark tool is stored
# output-file-path: test.log
# # Push and deploy GitHub pages branch automatically
# github-token: ${{ secrets.GITHUB_TOKEN }}
# auto-push: true

# Updating go report card for main branch only
- name: GoReportCard
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: curl --fail --request POST "https://goreportcard.com/checks" --data "repo=github.com/verloop/gocloak"
# # Updating go report card for main branch only
# - name: GoReportCard
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# run: curl --fail --request POST "https://goreportcard.com/checks" --data "repo=github.com/verloop/gocloak"
10 changes: 5 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func makeURL(path ...string) string {
// 0 if the provided version is equal to the server version
//
// 1 if the provided version is higher than the server version
func (g *GoCloak) compareVersions(v, token string, ctx context.Context) (int, error) {
func (g *GoCloak) compareVersions(ctx context.Context, v, token string) (int, error) {
curVersion := g.Config.version
if curVersion == "" {
curV, err := g.getServerVersion(ctx, token)
Expand All @@ -75,7 +75,7 @@ func (g *GoCloak) compareVersions(v, token string, ctx context.Context) (int, er
curVersion = curV
}

curVersion = "v" + g.Config.version
curVersion = "v" + curVersion
if v[0] != 'v' {
v = "v" + v
}
Expand Down Expand Up @@ -3646,7 +3646,7 @@ func (g *GoCloak) GetPolicies(ctx context.Context, token, realm, idOfClient stri
return nil, errors.Wrap(err, errMessage)
}

compResult, err := g.compareVersions("20.0.0", token, ctx)
compResult, err := g.compareVersions(ctx, "20.0.0", token)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -3678,7 +3678,7 @@ func (g *GoCloak) CreatePolicy(ctx context.Context, token, realm, idOfClient str
return nil, errors.New("type of a policy required")
}

compResult, err := g.compareVersions("20.0.0", token, ctx)
compResult, err := g.compareVersions(ctx, "20.0.0", token)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -3711,7 +3711,7 @@ func (g *GoCloak) UpdatePolicy(ctx context.Context, token, realm, idOfClient str
return errors.New("ID of a policy required")
}

compResult, err := g.compareVersions("20.0.0", token, ctx)
compResult, err := g.compareVersions(ctx, "20.0.0", token)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6610,19 +6610,19 @@ func Test_GetClientsWithPagination(t *testing.T) {
defer tearDown()
t.Log(createdClientID)
first := 0
max := 1
maxClients := 1
// Looking for a created client
clients, err := client.GetClients(
context.Background(),
token.AccessToken,
cfg.GoCloak.Realm,
gocloak.GetClientsParams{
First: &first,
Max: &max,
Max: &maxClients,
},
)
require.NoError(t, err)
require.Equal(t, max, len(clients))
require.Equal(t, maxClients, len(clients))
}

func Test_ImportIdentityProviderConfig(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,7 @@ type RequiredActionProviderRepresentation struct {
ProviderID *string `json:"providerId,omitempty"`
}

// UnregisteredRequiredActionProviderRepresentation is a representation of unregistered required actions
type UnregisteredRequiredActionProviderRepresentation struct {
Name *string `json:"name,omitempty"`
ProviderID *string `json:"providerId,omitempty"`
Expand Down
Loading