Skip to content

Commit edcbbf6

Browse files
committed
Merge tag 'v13.7.0' of https://github.com/Nerzal/gocloak
Release v13.7.0
2 parents 8674078 + 166f442 commit edcbbf6

24 files changed

+3811
-1855
lines changed

.github/workflows/go.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,21 @@ jobs:
66
tests:
77
runs-on: ubuntu-latest
88
steps:
9-
- name: Install Go
10-
uses: actions/setup-go@v2.1.3
9+
- name: Setup Go environment
10+
uses: actions/setup-go@v3.0.0
1111
with:
12-
go-version: 1.17
12+
go-version: 1.19
1313
- name: Checkout code
1414
uses: actions/checkout@v2
1515
- name: Run golangci-lint
16-
uses: golangci/[email protected]
17-
with:
18-
version: v1.28.3
16+
uses: golangci/[email protected]
1917
- name: WriteGoList
2018
run: go list -json -m all > go.list
2119
- name: nancy
2220
uses: sonatype-nexus-community/nancy-github-action@main
2321
- name: Run Keycloak
2422
run: |
25-
docker pull jboss/keycloak:12.0.3
26-
docker run -d -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=secret -e KEYCLOAK_IMPORT=/tmp/gocloak-realm.json -v "`pwd`/testdata/gocloak-realm.json:/tmp/gocloak-realm.json" -p 8080:8080 --name keycloak jboss/keycloak:12.0.3 -Dkeycloak.profile.feature.upload_scripts=enabled
23+
make start-keycloak
2724
sleep 15
2825
- name: Unit Tests
2926
run: |

.golangci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ linters:
99
- gofmt
1010
- misspell
1111
- gosec
12-
- maligned
1312
- unconvert
14-
- golint
13+
- revive
1514
- gocognit
1615
- gocyclo
1716
fast: true

.nancy-ignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CVE-2019-11840
1+
CVE-2022-32149

Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM quay.io/keycloak/keycloak:19.0
2+
COPY testdata data/import
3+
WORKDIR /opt/keycloak
4+
ENV KC_HOSTNAME=localhost
5+
ENV KEYCLOAK_USER=admin
6+
ENV KEYCLOAK_PASSWORD=secret
7+
ENV KEYCLOAK_ADMIN=admin
8+
ENV KEYCLOAK_ADMIN_PASSWORD=secret
9+
ENV KC_FEATURES=account-api,account2,authorization,client-policies,impersonation,docker,scripts,upload_scripts
10+
RUN /opt/keycloak/bin/kc.sh import --file /data/import/gocloak-realm.json
11+
ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]

Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
test:
22
./run-tests.sh
3-
3+
4+
start-keycloak: stop-keycloak
5+
docker-compose up -d
6+
7+
stop-keycloak:
8+
docker-compose down

README.md

+27-4
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ For release notes please consult the specific releases [here](https://github.com
3232
### Installation
3333

3434
```shell
35-
go get github.com/Nerzal/gocloak/v11
35+
go get github.com/Nerzal/gocloak/v13
3636
```
3737

3838
### Importing
3939

4040
```go
41-
import "github.com/Nerzal/gocloak/v11"
41+
import "github.com/Nerzal/gocloak/v13"
4242
```
4343

4444
### Create New User
@@ -80,7 +80,7 @@ go get github.com/Nerzal/gocloak/v11
8080
panic("Inspection failed:"+ err.Error())
8181
}
8282

83-
if !rptResult.Active {
83+
if !*rptResult.Active {
8484
panic("Token is not active")
8585
}
8686

@@ -160,6 +160,7 @@ type GoCloak interface {
160160
CreateClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string, roles []Role) error
161161
CreateClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string, roles []Role) error
162162
CreateClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfCLientScope string, roles []Role) error
163+
CreateClientScopesScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClientScope, idOfClient string, roles []Role) error
163164

164165
UpdateUser(ctx context.Context, accessToken, realm string, user User) error
165166
UpdateGroup(ctx context.Context, accessToken, realm string, updatedGroup Group) error
@@ -177,6 +178,7 @@ type GoCloak interface {
177178
DeleteClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string, roles []Role) error
178179
DeleteClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string, roles []Role) error
179180
DeleteClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfCLientScope string, roles []Role) error
181+
DeleteClientScopesScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClientScope, ifOfClient string, roles []Role) error
180182

181183
GetClient(ctx context.Context, accessToken, realm, idOfClient string) (*Client, error)
182184
GetClientsDefaultScopes(ctx context.Context, token, realm, idOfClient string) ([]*ClientScope, error)
@@ -193,8 +195,10 @@ type GoCloak interface {
193195
GetClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string) ([]*Role, error)
194196
GetClientScopeMappingsRealmRolesAvailable(ctx context.Context, token, realm, idOfClient string) ([]*Role, error)
195197
GetClientScopesScopeMappingsRealmRolesAvailable(ctx context.Context, token, realm, idOfClientScope string) ([]*Role, error)
198+
GetClientScopesScopeMappingsClientRolesAvailable(ctx context.Context, token, realm, idOfClientScope, idOfClient string) ([]*Role, error)
196199
GetClientScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string) ([]*Role, error)
197200
GetClientScopesScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClientScope string) ([]*Role, error)
201+
GetClientScopesScopeMappingsClientRoles(ctx context.Context, token, realm, idOfClientScope, idOfClient string) ([]*Role, error)
198202
GetClientScopeMappingsClientRolesAvailable(ctx context.Context, token, realm, idOfClient, idOfSelectedClient string) ([]*Role, error)
199203
GetClientSecret(ctx context.Context, token, realm, idOfClient string) (*CredentialRepresentation, error)
200204
GetClientServiceAccount(ctx context.Context, token, realm, idOfClient string) (*User, error)
@@ -338,7 +342,14 @@ type GoCloak interface {
338342
MoveCredentialBehind(ctx context.Context, token, realm, userID, credentialID, newPreviousCredentialID string) error
339343
MoveCredentialToFirst(ctx context.Context, token, realm, userID, credentialID string) error
340344

341-
// *** Identity Providers ***
345+
// *** Authentication Flows ***
346+
GetAuthenticationFlows(ctx context.Context, token, realm string) ([]*AuthenticationFlowRepresentation, error)
347+
GetAuthenticationFlow(ctx context.Context, token, realm string, authenticationFlowID string) (*AuthenticationFlowRepresentation, error)
348+
CreateAuthenticationFlow(ctx context.Context, token, realm string, flow AuthenticationFlowRepresentation) error
349+
UpdateAuthenticationFlow(ctx context.Context, token, realm string, flow AuthenticationFlowRepresentation, authenticationFlowID string) (*AuthenticationFlowRepresentation, error)
350+
DeleteAuthenticationFlow(ctx context.Context, token, realm, flowID string) error
351+
352+
// *** Identity Providers ***
342353

343354
CreateIdentityProvider(ctx context.Context, token, realm string, providerRep IdentityProviderRepresentation) (string, error)
344355
GetIdentityProvider(ctx context.Context, token, realm, alias string) (*IdentityProviderRepresentation, error)
@@ -464,6 +475,18 @@ yields
464475

465476
Note that empty parameters are not included, because of the use of ```omitempty``` in the type definitions.
466477

478+
## Examples
479+
480+
* [Add client role to user](./examples/ADD_CLIENT_ROLE_TO_USER.md)
481+
482+
* [Create User Federation & Sync](./examples/USER_FEDERATION.md)
483+
484+
* [Create User Federation & Sync with group ldap mapper](./examples/USER_FEDERATION_GROUP_LDAP_MAPPER.md)
485+
486+
* [Create User Federation & Sync with role ldap mapper](./examples/USER_FEDERATION_ROLE_LDAP_MAPPER.md)
487+
488+
* [Create User Federation & Sync with user attribute ldap mapper](./examples/USER_FEDERATION_USER_ATTRIBUTE_LDAP_MAPPER.md)
489+
467490
## License
468491

469492
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FNerzal%2Fgocloak.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FNerzal%2Fgocloak?ref=badge_large)

0 commit comments

Comments
 (0)