Skip to content

Commit b3fcfb9

Browse files
committed
feat: replace httpbin with mocktarget for identity facade and envoy quickstart
1 parent 87a376f commit b3fcfb9

19 files changed

+154
-154
lines changed

labs/idp-okta-integration/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,15 @@ This test will simulate a three-legged [OAuth 2.0](https://cloud.google.com/apig
180180
- You can generate the authorization url using the command below.
181181
182182
```bash
183-
export AUTH_URL="https://$APIGEE_X_HOSTNAME/v1/oauth20/authorize?client_id=$APIGEE_CLIENT_ID&response_type=code&scope=openid email profile&state=abcd-1234&redirect_uri=https://httpbin.org/get"
183+
export AUTH_URL="https://$APIGEE_X_HOSTNAME/v1/oauth20/authorize?client_id=$APIGEE_CLIENT_ID&response_type=code&scope=openid email profile&state=abcd-1234&redirect_uri=https://mocktarget.apigee.net/echo"
184184
echo $AUTH_URL
185185
```
186186
187187
2. Apigee will redirect to Okta to generate an authorization code. Log in using the Okta credentials for the user created earlier.
188188
189189
![Okta Auth](assets/okta-auth-code-login.png)
190190
191-
3. After successful authentication, Okta redirects to the Apigee callback URL (/v1/oauth20/callback), which controls the incoming query parameters, generate an authorization code (using the same value as the one provided by Okta) and performs a redirection on the client app redirect_uri `https://httpbin.org/get` providing the authorization_code and initial state parameters.
191+
3. After successful authentication, Okta redirects to the Apigee callback URL (/v1/oauth20/callback), which controls the incoming query parameters, generate an authorization code (using the same value as the one provided by Okta) and performs a redirection on the client app redirect_uri `https://mocktarget.apigee.net/echo` providing the authorization_code and initial state parameters.
192192
193193
- In a real-world scenario, the redirection would be back to the client application and it would parse Okta's response to capture the authorization code
194194
@@ -201,7 +201,7 @@ This test will simulate a three-legged [OAuth 2.0](https://cloud.google.com/apig
201201
export APIGEE_RESPONSE=$(curl -s --location --request POST "https://$APIGEE_X_HOSTNAME/v1/oauth20/token?client_id=$APIGEE_CLIENT_ID" \
202202
--header "Authorization: Basic $BASE64_ENCODED" \
203203
--header 'Content-Type: application/x-www-form-urlencoded' \
204-
--data-urlencode 'redirect_uri=https://httpbin.org/get' \
204+
--data-urlencode 'redirect_uri=https://mocktarget.apigee.net/echo' \
205205
--data-urlencode 'grant_type=authorization_code' \
206206
--data-urlencode "code=$AUTH_CODE")
207207
echo $APIGEE_RESPONSE
@@ -266,7 +266,7 @@ The default Apigee install includes a /hello-world proxy. In this section we wil
266266
export APIGEE_CLIENT_ID=F3gGHZGtPPg6FcZqo0JwXFbV2NVkW0ILOXKte9HMFWJsOgR8
267267
export APIGEE_SECRET=3m5VFXhQIcMO45dhK8YZ85Svw97iTIdiuBnIQMSPJQrZHQQrkQ1aPsYJ3gWVec41
268268
export BASE64_ENCODED=$(echo -n $APIGEE_CLIENT_ID:$APIGEE_SECRET | base64)
269-
export AUTH_URL="https://$APIGEE_X_HOSTNAME/v1/oauth20/authorize?client_id=$APIGEE_CLIENT_ID&response_type=code&scope=openid email profile&state=abcd-1234&redirect_uri=https://httpbin.org/get"
269+
export AUTH_URL="https://$APIGEE_X_HOSTNAME/v1/oauth20/authorize?client_id=$APIGEE_CLIENT_ID&response_type=code&scope=openid email profile&state=abcd-1234&redirect_uri=https://mocktarget.apigee.net/echo"
270270
echo "$AUTH_URL"
271271
```
272272
@@ -285,7 +285,7 @@ The default Apigee install includes a /hello-world proxy. In this section we wil
285285
export AUTH_CODE={authorization code returned above}
286286
export APIGEE_RESPONSE=$(curl -s --location --request POST "https://$APIGEE_X_HOSTNAME/v1/oauth20/token?client_id=$APIGEE_CLIENT_ID" \--header "Authorization: Basic $BASE64_ENCODED" \
287287
--header 'Content-Type: application/x-www-form-urlencoded' \
288-
--data-urlencode 'redirect_uri=https://httpbin.org/get' \
288+
--data-urlencode 'redirect_uri=https://mocktarget.apigee.net/echo' \
289289
--data-urlencode 'grant_type=authorization_code' \
290290
--data-urlencode "code=$AUTH_CODE")
291291

references/identity-facade/pipeline.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ generate_edge_json() {
206206
"apiProducts": [
207207
"IdentityFacade"
208208
],
209-
"callbackUrl": "https://httpbin.org/get",
209+
"callbackUrl": "https://mocktarget.apigee.net/echo",
210210
"scopes": []
211211
}
212212
]
@@ -259,7 +259,7 @@ generate_authz_url() {
259259
RESPONSE_TYPE="&response_type=code"
260260
SCOPE="&scope=openid email profile"
261261
STATE="&state=abcd-1234"
262-
REDIRECT_URI="&redirect_uri=https://httpbin.org/get"
262+
REDIRECT_URI="&redirect_uri=https://mocktarget.apigee.net/echo"
263263

264264
# is pkce enabled (=true) or not
265265
if [ "$4" = "true" ];then

references/identity-facade/test/integration/features/identity-facade.authorize-pkce.feature

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
@pkce @authorize
22
Feature:
3-
As a Client App
3+
As a Client App
44
I want to access the protected resource of an API
55
So that I can retrieve different types of information
66

77
Scenario: I should get an error if client_id is missing or invalid
8-
When I GET /authorize?client_id=xxx&redirect_uri=https://httpbin.org/get&response_type=code&state=12345&scope=openid%20email`pkceCodeVerifier`
8+
When I GET /authorize?client_id=xxx&redirect_uri=https://mocktarget.apigee.net/echo&response_type=code&state=12345&scope=openid%20email`pkceCodeVerifier`
99
Then response code should be 401
1010
And response body should be valid json
1111

1212
Scenario: I should get an error if client_id contains heading or trailing spaces
13-
When I GET /authorize?client_id=`spaceCharacters``clientId`&redirect_uri=https://httpbin.org/get&response_type=code&state=12345&scope=openid%20email`pkceCodeVerifier`
13+
When I GET /authorize?client_id=`spaceCharacters``clientId`&redirect_uri=https://mocktarget.apigee.net/echo&response_type=code&state=12345&scope=openid%20email`pkceCodeVerifier`
1414
Then response code should be 401
1515
And response body should be valid json
16-
16+
1717
Scenario: I should get an error if redirect_uri is missing or invalid
1818
When I GET /authorize?client_id=`clientId`&redirect_uri=https://example.com/invalid&response_type=code&state=12345&scope=openid%20email`pkceCodeVerifier`
1919
Then response code should be 400
2020
And response body path $.error should be invalid_request
21-
21+
2222
Scenario: I should get an error if response_type is missing or invalid
2323
Given I navigate to the authorize page with an invalid response type
2424
Then I am redirected to the Client App
@@ -28,7 +28,7 @@ Feature:
2828
Given I navigate to the authorize page without a scope parameter
2929
Then I am redirected to the Client App
3030
Then I receive an invalid_request error
31-
31+
3232
Scenario: User Authorizes with state missing
3333
Given I navigate to the authorize page without a state parameter
3434
When I sign in and consent

references/identity-facade/test/integration/features/identity-facade.authorize.feature

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
@authorize
22
Feature:
3-
As a Client App
3+
As a Client App
44
I want to access the protected resource of an API
55
So that I can retrieve different types of information
66

77
Scenario: I should get an error if client_id is missing or invalid
8-
When I GET /authorize?client_id=xxx&redirect_uri=https://httpbin.org/get&response_type=code&state=12345&scope=openid%20email
8+
When I GET /authorize?client_id=xxx&redirect_uri=https://mocktarget.apigee.net/echo&response_type=code&state=12345&scope=openid%20email
99
Then response code should be 401
1010
And response body should be valid json
1111

1212
Scenario: I should get an error if client_id contains heading or trailing spaces
13-
When I GET /authorize?client_id=`spaceCharacters``clientId`&redirect_uri=https://httpbin.org/get&response_type=code&state=12345&scope=openid%20email
13+
When I GET /authorize?client_id=`spaceCharacters``clientId`&redirect_uri=https://mocktarget.apigee.net/echo&response_type=code&state=12345&scope=openid%20email
1414
Then response code should be 401
1515
And response body should be valid json
16-
16+
1717
Scenario: I should get an error if redirect_uri is missing or invalid
1818
When I GET /authorize?client_id=`clientId`&redirect_uri=https://example.com/invalid&response_type=code&state=12345&scope=openid%20email
1919
Then response code should be 400
2020
And response body path $.error should be invalid_request
21-
21+
2222
Scenario: I should get an error if response_type is missing or invalid
2323
Given I navigate to the authorize page with an invalid response type
2424
Then I am redirected to the Client App
@@ -28,14 +28,14 @@ Feature:
2828
Given I navigate to the authorize page without a scope parameter
2929
Then I am redirected to the Client App
3030
Then I receive an invalid_request error
31-
31+
3232
Scenario: User Authorizes with state missing
3333
Given I navigate to the authorize page without a state parameter
3434
When I sign in and consent
3535
Then I am redirected to the Client App
3636
And I receive an auth code in a query param
3737
And I store the auth code in global scope
38-
38+
3939
Scenario: User Authorizes
4040
Given I navigate to the authorize page
4141
When I sign in and consent

references/identity-facade/test/integration/features/identity-facade.end2end-pkce.feature

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@pkce @end2end
22
Feature:
3-
As a Client App
3+
As a Client App
44
I want to access the protected resource of an API
55
So that I can retrieve different types of information
66

@@ -14,11 +14,11 @@ Feature:
1414

1515
Scenario: Generate Access Token
1616
Given I have basic authentication credentials `clientId` and `clientSecret`
17-
And I set form parameters to
17+
And I set form parameters to
1818
| parameter | value |
1919
| grant_type | authorization_code |
2020
| code | `authCode` |
21-
| redirect_uri| https://httpbin.org/get |
21+
| redirect_uri| https://mocktarget.apigee.net/echo |
2222
| state | `state` |
2323
| scope | `scope` |
2424
| code_verifier | `codeVerifier` |

references/identity-facade/test/integration/features/identity-facade.end2end.feature

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@end2end
22
Feature:
3-
As a Client App
3+
As a Client App
44
I want to access the protected resource of an API
55
So that I can retrieve different types of information
66

@@ -14,11 +14,11 @@ Feature:
1414

1515
Scenario: Generate Access Token
1616
Given I have basic authentication credentials `clientId` and `clientSecret`
17-
And I set form parameters to
17+
And I set form parameters to
1818
| parameter | value |
1919
| grant_type | authorization_code |
2020
| code | `authCode` |
21-
| redirect_uri| https://httpbin.org/get |
21+
| redirect_uri| https://mocktarget.apigee.net/echo |
2222
| state | `state` |
2323
| scope | `scope` |
2424
When I POST to /token

references/identity-facade/test/integration/features/identity-facade.token-basic-auth.feature

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@token
22
Feature:
3-
As a Client App
3+
As a Client App
44
I want to access the protected resource of an API
55
So that I can retrieve different types of information
66

@@ -14,76 +14,76 @@ Feature:
1414

1515
Scenario: Generate Access Token
1616
Given I have basic authentication credentials `clientId` and `clientSecret`
17-
And I set form parameters to
17+
And I set form parameters to
1818
| parameter | value |
1919
| grant_type | authorization_code |
2020
| code | `authCode` |
21-
| redirect_uri| https://httpbin.org/get |
21+
| redirect_uri| https://mocktarget.apigee.net/echo |
2222
When I POST to /token
2323
Then response code should be 200
2424
And I store the value of body path $.access_token as userToken in global scope
2525

2626
Scenario: I should get an error if client_id is invalid
2727
Given I have basic authentication credentials invalid-client_id and `clientSecret`
28-
And I set form parameters to
28+
And I set form parameters to
2929
| parameter | value |
3030
| grant_type | authorization_code |
3131
| code | `authCode` |
32-
| redirect_uri| https://httpbin.org/get |
32+
| redirect_uri| https://mocktarget.apigee.net/echo |
3333
When I POST to /token
3434
Then response code should be 401
3535
And response body should be valid json
3636

3737
Scenario: I should get an error if client_secret is invalid
3838
Given I have basic authentication credentials `clientId` and invalid-client_secret
39-
And I set form parameters to
39+
And I set form parameters to
4040
| parameter | value |
4141
| grant_type | authorization_code |
4242
| code | `authCode` |
43-
| redirect_uri| https://httpbin.org/get |
43+
| redirect_uri| https://mocktarget.apigee.net/echo |
4444
When I POST to /token
4545
Then response code should be 401
4646
And response body path $.error should be invalid_client
4747

4848
Scenario: I should get an error if redirect_uri is missing or invalid
4949
Given I have basic authentication credentials `clientId` and `clientSecret`
50-
And I set form parameters to
50+
And I set form parameters to
5151
| parameter | value |
5252
| grant_type | authorization_code |
5353
| code | `authCode` |
5454
| redirect_uri| https://example.com/invalid |
5555
When I POST to /token
5656
Then response code should be 400
5757
And response body path $.error should be invalid_request
58-
58+
5959
Scenario: I should get an error if authorization code is invalid
6060
Given I have basic authentication credentials `clientId` and `clientSecret`
61-
And I set form parameters to
61+
And I set form parameters to
6262
| parameter | value |
6363
| grant_type | authorization_code |
6464
| code | invalid-code |
65-
| redirect_uri| https://httpbin.org/get |
65+
| redirect_uri| https://mocktarget.apigee.net/echo |
6666
When I POST to /token
6767
Then response code should be 404
6868
And response body should be valid json
6969

7070
Scenario: I should get an error if authorization code is missing
7171
Given I have basic authentication credentials `clientId` and `clientSecret`
72-
And I set form parameters to
72+
And I set form parameters to
7373
| parameter | value |
7474
| grant_type | authorization_code |
75-
| redirect_uri| https://httpbin.org/get |
75+
| redirect_uri| https://mocktarget.apigee.net/echo |
7676
When I POST to /token
7777
Then response code should be 400
7878
And response body path $.error should be invalid_grant
7979

8080
Scenario: I should get an error if grant_type is not authorization_code
8181
Given I have basic authentication credentials `clientId` and `clientSecret`
82-
And I set form parameters to
82+
And I set form parameters to
8383
| parameter | value |
8484
| grant_type | xxx |
8585
| code | `authCode` |
86-
| redirect_uri| https://httpbin.org/get |
86+
| redirect_uri| https://mocktarget.apigee.net/echo |
8787
When I POST to /token
8888
Then response code should be 400
8989
And response body path $.error should be unsupported_grant_type

references/identity-facade/test/integration/features/identity-facade.token-forms-auth.feature

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@token
22
Feature:
3-
As a Client App
3+
As a Client App
44
I want to access the protected resource of an API
55
So that I can retrieve different types of information
66

@@ -13,43 +13,43 @@ Feature:
1313
And I store the state parameter in global scope
1414

1515
Scenario: Generate Access Token
16-
Given I set form parameters to
16+
Given I set form parameters to
1717
| parameter | value |
1818
| grant_type | authorization_code |
1919
| code | `authCode` |
20-
| redirect_uri| https://httpbin.org/get |
20+
| redirect_uri| https://mocktarget.apigee.net/echo |
2121
| client_id | `clientId` |
2222
| client_secret | `clientSecret` |
2323
When I POST to /token
2424
Then response code should be 200
2525
And I store the value of body path $.access_token as userToken in global scope
2626

2727
Scenario: I should get an error if client_id is invalid
28-
Given I set form parameters to
28+
Given I set form parameters to
2929
| parameter | value |
3030
| grant_type | authorization_code |
3131
| code | `authCode` |
32-
| redirect_uri| https://httpbin.org/get |
32+
| redirect_uri| https://mocktarget.apigee.net/echo |
3333
| client_id | invalid-client |
3434
| client_secret | `clientSecret` |
3535
When I POST to /token
3636
Then response code should be 401
3737
And response body should be valid json
3838

3939
Scenario: I should get an error if client_secret is invalid
40-
Given I set form parameters to
40+
Given I set form parameters to
4141
| parameter | value |
4242
| grant_type | authorization_code |
4343
| code | `authCode` |
44-
| redirect_uri| https://httpbin.org/get |
44+
| redirect_uri| https://mocktarget.apigee.net/echo |
4545
| client_id | `clientId` |
4646
| client_secret | invalid-client |
4747
When I POST to /token
4848
Then response code should be 401
4949
And response body path $.error should be invalid_client
5050

5151
Scenario: I should get an error if redirect_uri is missing or invalid
52-
Given I set form parameters to
52+
Given I set form parameters to
5353
| parameter | value |
5454
| grant_type | authorization_code |
5555
| code | `authCode` |
@@ -59,36 +59,36 @@ Feature:
5959
When I POST to /token
6060
Then response code should be 400
6161
And response body path $.error should be invalid_request
62-
62+
6363
Scenario: I should get an error if authorization code is invalid
64-
Given I set form parameters to
64+
Given I set form parameters to
6565
| parameter | value |
6666
| grant_type | authorization_code |
6767
| code | invalid-code |
68-
| redirect_uri| https://httpbin.org/get |
68+
| redirect_uri| https://mocktarget.apigee.net/echo |
6969
| client_id | `clientId` |
7070
| client_secret | `clientSecret` |
7171
When I POST to /token
7272
Then response code should be 404
7373
And response body should be valid json
7474

7575
Scenario: I should get an error if authorization code is missing
76-
Given I set form parameters to
76+
Given I set form parameters to
7777
| parameter | value |
7878
| grant_type | authorization_code |
79-
| redirect_uri| https://httpbin.org/get |
79+
| redirect_uri| https://mocktarget.apigee.net/echo |
8080
| client_id | `clientId` |
8181
| client_secret | `clientSecret` |
8282
When I POST to /token
8383
Then response code should be 400
8484
And response body path $.error should be invalid_grant
8585

8686
Scenario: I should get an error if grant_type is not authorization_code
87-
Given I set form parameters to
87+
Given I set form parameters to
8888
| parameter | value |
8989
| grant_type | xxx |
9090
| code | `authCode` |
91-
| redirect_uri| https://httpbin.org/get |
91+
| redirect_uri| https://mocktarget.apigee.net/echo |
9292
| client_id | `clientId` |
9393
| client_secret | `clientSecret` |
9494
When I POST to /token

0 commit comments

Comments
 (0)