-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from wayofdev/feat/keycloak-tests
- Loading branch information
Showing
9 changed files
with
183 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
### Successful User Login | ||
|
||
POST {{public_url}}/token | ||
Content-Type: application/x-www-form-urlencoded | ||
User-Agent: PhpStorm | ||
|
||
client_id=user&username=john.roe&password=john.roe&grant_type=password | ||
|
||
> {% | ||
client.global.set("access_token", response.body.access_token); | ||
client.global.set("refresh_token", response.body.refresh_token); | ||
%} | ||
|
||
### Failed User Login | ||
|
||
POST {{public_url}}/token | ||
Accept: application/json | ||
Content-Type: application/x-www-form-urlencoded | ||
User-Agent: PhpStorm | ||
|
||
client_id=user&username=john.roe&password=wrong&grant_type=password | ||
|
||
### Successful Logout | ||
|
||
POST {{public_url}}/logout | ||
Accept: application/json | ||
Content-Type: application/x-www-form-urlencoded | ||
X-Auth-Refresh-Token: {{refresh_token}} | ||
User-Agent: PhpStorm | ||
|
||
client_id=user&refresh_token={{refresh_token}} | ||
|
||
### Failed Logout | ||
|
||
POST {{public_url}}/logout | ||
Accept: application/json | ||
Content-Type: application/x-www-form-urlencoded | ||
X-Auth-Refresh-Token: {{refresh_token}} | ||
User-Agent: PhpStorm | ||
|
||
client_id=user&refresh_token=invalid_token | ||
|
||
### Successful Refresh-Token | ||
|
||
POST {{public_url}}/refresh | ||
Accept: application/json | ||
Content-Type: application/x-www-form-urlencoded | ||
X-Auth-Refresh-Token: {{refresh_token}} | ||
User-Agent: PhpStorm | ||
|
||
client_id=user&grant_type=refresh_token&refresh_token={{refresh_token}} | ||
|
||
### Failed Refresh-Token | ||
|
||
POST {{public_url}}/refresh | ||
Accept: application/json | ||
Content-Type: application/x-www-form-urlencoded | ||
X-Auth-Refresh-Token: {{refresh_token}} | ||
User-Agent: PhpStorm | ||
|
||
client_id=user&grant_type=refresh_token&refresh_token=invalid_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"development": { | ||
"client_username": "john.roe", | ||
"client_password": "john.roe", | ||
"agent_username": "john.doe", | ||
"agent_password": "john.doe", | ||
"public_url": "https://auth.vbase.docker/realms/client/protocol/openid-connect", | ||
"private_url": "https://auth.vbase.docker/realms/operations/protocol/openid-connect", | ||
"third_party_url": "https://auth.vbase.docker/realms/third-party/protocol/openid-connect", | ||
"auth_url": "https://auth.vbase.docker", | ||
"private_api_key": "secret" | ||
}, | ||
"production": { | ||
"client_username": "john.roe", | ||
"client_password": "john.roe", | ||
"agent_username": "john.doe", | ||
"agent_password": "john.doe", | ||
"public_url": "https://auth.vbase.io/realms/client/protocol/openid-connect", | ||
"private_url": "https://auth.vbase.io/realms/operations/protocol/openid-connect", | ||
"third_party_url": "https://auth.vbase.io/realms/third-party/protocol/openid-connect", | ||
"auth_url": "https://auth.vbase.io", | ||
"private_api_key": "secret" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,22 +9,29 @@ ${KCADM} config credentials --server "$KC_INTERNAL_HOSTNAME_URL" --realm master | |
${KCADM} create realms \ | ||
-s "realm=${OIDC_CLIENT_REALM}" \ | ||
-s enabled=true \ | ||
-s 'displayName="Company Clients"' \ | ||
-s displayName="${OIDC_CLIENT_REALM_DISPLAY_NAME}" \ | ||
-s accessTokenLifespan=300 \ | ||
-s ssoSessionIdleTimeout=3600 \ | ||
-s ssoSessionMaxLifespan=3600 \ | ||
-s revokeRefreshToken=true \ | ||
-s refreshTokenMaxReuse=0 \ | ||
-s defaultSignatureAlgorithm=RS256 \ | ||
-s editUsernameAllowed=true | ||
-s editUsernameAllowed=true \ | ||
-s registrationEmailAsUsername=true \ | ||
-s registrationAllowed=true \ | ||
-s resetPasswordAllowed=true \ | ||
-s rememberMe=true \ | ||
-s duplicateEmailsAllowed=false \ | ||
-s loginTheme=keywind | ||
|
||
${KCADM} create clients -r "${OIDC_CLIENT_REALM}" -f - <<EOF | ||
{ | ||
"protocol": "openid-connect", | ||
"clientId": "${OIDC_CLIENT_APP_ID}", | ||
"directAccessGrantsEnabled": true, | ||
"webOrigins": ["*"], | ||
"standardFlowEnabled": false, | ||
"redirectUris": ["*"], | ||
"standardFlowEnabled": true, | ||
"clientAuthenticatorType": "client-secret", | ||
"secret": "${OIDC_CLIENT_APP_SECRET}", | ||
"bearerOnly": false, | ||
|
@@ -43,8 +50,9 @@ ${KCADM} create clients -r "${OIDC_CLIENT_REALM}" -f - <<EOF | |
"clientId": "${OIDC_CLIENT_USER_ID}", | ||
"directAccessGrantsEnabled": true, | ||
"webOrigins": ["*"], | ||
"redirectUris": ["*"], | ||
"bearerOnly": false, | ||
"standardFlowEnabled": false, | ||
"standardFlowEnabled": true, | ||
"publicClient": true, | ||
"serviceAccountsEnabled": false, | ||
"authorizationServicesEnabled": false, | ||
|
@@ -55,18 +63,47 @@ ${KCADM} create clients -r "${OIDC_CLIENT_REALM}" -f - <<EOF | |
EOF | ||
|
||
### Users | ||
${KCADM} create users -r "${OIDC_CLIENT_REALM}" -s enabled=true -s emailVerified=true -s username=john.roe -s [email protected] -s firstName=John -s lastName=Roe | ||
${KCADM} set-password -r "${OIDC_CLIENT_REALM}" --username john.roe --new-password john.roe | ||
${KCADM} create users -r "${OIDC_CLIENT_REALM}" -s enabled=true -s emailVerified=true -s username=john.roe@wayof.dev -s [email protected] -s firstName=John -s lastName=Roe | ||
${KCADM} set-password -r "${OIDC_CLIENT_REALM}" --username john.roe@wayof.dev --new-password john.roe | ||
|
||
${KCADM} create users -r "${OIDC_CLIENT_REALM}" -s enabled=true -s emailVerified=true -s username=jane.roe -s [email protected] -s firstName=Jane -s lastName=Roe | ||
${KCADM} set-password -r "${OIDC_CLIENT_REALM}" --username jane.roe --new-password jane.roe | ||
${KCADM} create users -r "${OIDC_CLIENT_REALM}" -s enabled=true -s emailVerified=true -s username=jane.roe@wayof.dev -s [email protected] -s firstName=Jane -s lastName=Roe | ||
${KCADM} set-password -r "${OIDC_CLIENT_REALM}" --username jane.roe@wayof.dev --new-password jane.roe | ||
|
||
${KCADM} create users -r "${OIDC_CLIENT_REALM}" -s enabled=true -s emailVerified=true -s username=johnny.roe -s [email protected] -s firstName=Johnny -s lastName=Roe | ||
${KCADM} set-password -r "${OIDC_CLIENT_REALM}" --username johnny.roe --new-password johnny.roe | ||
${KCADM} create users -r "${OIDC_CLIENT_REALM}" -s enabled=true -s emailVerified=true -s username=johnny.roe@wayof.dev -s [email protected] -s firstName=Johnny -s lastName=Roe | ||
${KCADM} set-password -r "${OIDC_CLIENT_REALM}" --username johnny.roe@wayof.dev --new-password johnny.roe | ||
|
||
### Roles | ||
${KCADM} add-roles \ | ||
-r "${OIDC_CLIENT_REALM}" \ | ||
--uusername "service-account-${OIDC_CLIENT_APP_ID}" \ | ||
--cclientid realm-management \ | ||
--rolename manage-users | ||
|
||
### Identity Providers | ||
${KCADM} create identity-provider/instances -r "${OIDC_CLIENT_REALM}" -f - <<EOF | ||
{ | ||
"alias": "google", | ||
"providerId": "google", | ||
"enabled": true, | ||
"trustEmail": true, | ||
"config": { | ||
"useJwksUrl": true, | ||
"clientId": "${OIDC_IDP_GOOGLE_CLIENT_ID}", | ||
"clientSecret": "${OIDC_IDP_GOOGLE_CLIENT_SECRET}" | ||
} | ||
} | ||
EOF | ||
|
||
${KCADM} create identity-provider/instances -r "${OIDC_CLIENT_REALM}" -f - <<EOF | ||
{ | ||
"alias": "facebook", | ||
"providerId": "google", | ||
"enabled": true, | ||
"trustEmail": true, | ||
"config": { | ||
"useJwksUrl": true, | ||
"clientId": "${OIDC_IDP_FACEBOOK_CLIENT_ID}", | ||
"clientSecret": "${OIDC_IDP_FACEBOOK_CLIENT_SECRET}" | ||
} | ||
} | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,21 +9,29 @@ ${KCADM} config credentials --server "$KC_INTERNAL_HOSTNAME_URL" --realm master | |
${KCADM} create realms \ | ||
-s "realm=${OIDC_ADMIN_REALM}" \ | ||
-s enabled=true \ | ||
-s 'displayName="Company Employees"' \ | ||
-s displayName="${OIDC_ADMIN_REALM_DISPLAY_NAME}" \ | ||
-s accessTokenLifespan=300 \ | ||
-s ssoSessionIdleTimeout=3600 \ | ||
-s ssoSessionMaxLifespan=3600 \ | ||
-s revokeRefreshToken=true \ | ||
-s refreshTokenMaxReuse=0 \ | ||
-s defaultSignatureAlgorithm=RS256 | ||
-s defaultSignatureAlgorithm=RS256 \ | ||
-s editUsernameAllowed=false \ | ||
-s registrationEmailAsUsername=true \ | ||
-s registrationAllowed=false \ | ||
-s resetPasswordAllowed=true \ | ||
-s rememberMe=true \ | ||
-s duplicateEmailsAllowed=false \ | ||
-s loginTheme=keywind | ||
|
||
${KCADM} create clients -r ${OIDC_ADMIN_REALM} -f - <<EOF | ||
{ | ||
"protocol": "openid-connect", | ||
"clientId": "${OIDC_ADMIN_APP_ID}", | ||
"directAccessGrantsEnabled": true, | ||
"webOrigins": ["*"], | ||
"standardFlowEnabled": false, | ||
"redirectUris": ["*"], | ||
"standardFlowEnabled": true, | ||
"clientAuthenticatorType": "client-secret", | ||
"secret": "${OIDC_ADMIN_APP_SECRET}", | ||
"bearerOnly": false, | ||
|
@@ -42,8 +50,9 @@ ${KCADM} create clients -r ${OIDC_ADMIN_REALM} -f - <<EOF | |
"clientId": "${OIDC_ADMIN_USER_ID}", | ||
"directAccessGrantsEnabled": true, | ||
"webOrigins": ["*"], | ||
"redirectUris": ["*"], | ||
"bearerOnly": false, | ||
"standardFlowEnabled": false, | ||
"standardFlowEnabled": true, | ||
"publicClient": true, | ||
"serviceAccountsEnabled": false, | ||
"authorizationServicesEnabled": false, | ||
|
@@ -54,14 +63,14 @@ ${KCADM} create clients -r ${OIDC_ADMIN_REALM} -f - <<EOF | |
EOF | ||
|
||
### Users | ||
${KCADM} create users -r ${OIDC_ADMIN_REALM} -s enabled=true -s emailVerified=true -s username=john.doe -s [email protected] -s firstName=John -s lastName=Doe | ||
${KCADM} set-password -r ${OIDC_ADMIN_REALM} --username john.doe --new-password john.doe | ||
${KCADM} create users -r ${OIDC_ADMIN_REALM} -s enabled=true -s emailVerified=true -s username=john.doe@wayof.dev -s [email protected] -s firstName=John -s lastName=Doe | ||
${KCADM} set-password -r ${OIDC_ADMIN_REALM} --username john.doe@wayof.dev --new-password john.doe | ||
|
||
${KCADM} create users -r ${OIDC_ADMIN_REALM} -s enabled=true -s emailVerified=true -s username=jane.doe -s [email protected] -s firstName=Jane -s lastName=Doe | ||
${KCADM} set-password -r ${OIDC_ADMIN_REALM} --username jane.doe --new-password jane.doe | ||
${KCADM} create users -r ${OIDC_ADMIN_REALM} -s enabled=true -s emailVerified=true -s username=jane.doe@wayof.dev -s [email protected] -s firstName=Jane -s lastName=Doe | ||
${KCADM} set-password -r ${OIDC_ADMIN_REALM} --username jane.doe@wayof.dev --new-password jane.doe | ||
|
||
${KCADM} create users -r ${OIDC_ADMIN_REALM} -s enabled=true -s emailVerified=true -s username=johnny.doe -s [email protected] -s firstName=Johnny -s lastName=Doe | ||
${KCADM} set-password -r ${OIDC_ADMIN_REALM} --username johnny.doe --new-password johnny.doe | ||
${KCADM} create users -r ${OIDC_ADMIN_REALM} -s enabled=true -s emailVerified=true -s username=johnny.doe@wayof.dev -s [email protected] -s firstName=Johnny -s lastName=Doe | ||
${KCADM} set-password -r ${OIDC_ADMIN_REALM} --username johnny.doe@wayof.dev --new-password johnny.doe | ||
|
||
### Roles | ||
${KCADM} add-roles \ | ||
|