forked from wso2/carbon-apimgt
-
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.
Fixing ScopeNotFound issue when API defaultSecurityScheme has other o…
…authFlows (wso2#6453) * Fixing ScopeNotFound issue when API default securityScheme has other oauthFlows * Adding unit tests * Fixing formatting issues
- Loading branch information
1 parent
a1815eb
commit 3063e44
Showing
10 changed files
with
395 additions
and
1 deletion.
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
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
55 changes: 55 additions & 0 deletions
55
....apimgt.impl/src/test/resources/definitions/oas3/default_multiple_oauth_flows_scopes.yaml
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,55 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: TEST_API | ||
version: '1.0.0' | ||
servers: | ||
- url: 'https://localhost:8080/test_backend' | ||
security: | ||
- default: [] | ||
paths: | ||
/testpath: | ||
get: | ||
parameters: [] | ||
responses: | ||
'200': | ||
description: ok | ||
security: | ||
- OAuth2Security: | ||
- TEST_SCOPE1 | ||
x-auth-type: Application & Application User | ||
x-throttling-tier: 10KPerMin | ||
x-wso2-application-security: | ||
security-types: | ||
- oauth2 | ||
optional: false | ||
components: | ||
securitySchemes: | ||
default: | ||
type: oauth2 | ||
flows: | ||
implicit: | ||
authorizationUrl: 'https://test.com' | ||
scopes: | ||
TEST_SCOPE1: 'HI TEST_SCOPE1' | ||
TEST_SCOPE3: '' | ||
x-scopes-bindings: | ||
TEST_SCOPE1: admin | ||
TEST_SCOPE3: 'internal/publisher' | ||
password: | ||
tokenUrl: 'https://localhost:9443/oauth2/token' | ||
scopes: | ||
TEST_SCOPE1: 'TEST_SCOPE1' | ||
TEST_SCOPE2: 'Hi TEST_SCOPE2' | ||
x-scopes-bindings: | ||
TEST_SCOPE1: 'admin' | ||
clientCredentials: | ||
tokenUrl: https://api.gettyimages.com/oauth2/token/ | ||
scopes: {} | ||
authorizationCode: | ||
authorizationUrl: https://slack.com/oauth/authorize | ||
tokenUrl: https://slack.com/api/oauth.access | ||
scopes: | ||
TEST_SCOPE4: 'Hi TEST_SCOPE4' | ||
x-scopes-bindings: | ||
TEST_SCOPE4: 'admin' | ||
x-wso2-basePath: /test_context/0.1 |
82 changes: 82 additions & 0 deletions
82
...mpl/src/test/resources/definitions/oas3/default_multiple_oauth_flows_scopes_response.json
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,82 @@ | ||
{ | ||
"openapi" : "3.0.1", | ||
"info" : { | ||
"title" : "TEST_API", | ||
"version" : "1.0.0" | ||
}, | ||
"servers" : [ { | ||
"url" : "https://localhost:8080/test_backend" | ||
} ], | ||
"security" : [ { | ||
"default" : [ ] | ||
} ], | ||
"paths" : { | ||
"/testpath" : { | ||
"get" : { | ||
"parameters" : [ ], | ||
"responses" : { | ||
"200" : { | ||
"description" : "ok" | ||
} | ||
}, | ||
"security" : [ { | ||
"OAuth2Security" : [ "TEST_SCOPE1" ] | ||
} ], | ||
"x-auth-type" : "Application & Application User", | ||
"x-throttling-tier" : "10KPerMin", | ||
"x-wso2-application-security" : { | ||
"security-types" : [ "oauth2" ], | ||
"optional" : false | ||
} | ||
} | ||
} | ||
}, | ||
"components" : { | ||
"securitySchemes" : { | ||
"default" : { | ||
"type" : "oauth2", | ||
"flows" : { | ||
"implicit" : { | ||
"authorizationUrl" : "https://test.com", | ||
"scopes" : { | ||
"TEST_SCOPE1" : "HI TEST_SCOPE1", | ||
"TEST_SCOPE3" : "", | ||
"TEST_SCOPE2" : "Hi TEST_SCOPE2", | ||
"TEST_SCOPE4" : "Hi TEST_SCOPE4" | ||
}, | ||
"x-scopes-bindings" : { | ||
"TEST_SCOPE1" : "admin", | ||
"TEST_SCOPE3" : "internal/publisher", | ||
"TEST_SCOPE4" : "admin" | ||
} | ||
}, | ||
"password" : { | ||
"tokenUrl" : "https://localhost:9443/oauth2/token", | ||
"scopes" : { | ||
"TEST_SCOPE1" : "TEST_SCOPE1", | ||
"TEST_SCOPE2" : "Hi TEST_SCOPE2" | ||
}, | ||
"x-scopes-bindings" : { | ||
"TEST_SCOPE1" : "admin" | ||
} | ||
}, | ||
"clientCredentials" : { | ||
"tokenUrl" : "https://api.gettyimages.com/oauth2/token/", | ||
"scopes" : { } | ||
}, | ||
"authorizationCode" : { | ||
"authorizationUrl" : "https://slack.com/oauth/authorize", | ||
"tokenUrl" : "https://slack.com/api/oauth.access", | ||
"scopes" : { | ||
"TEST_SCOPE4" : "Hi TEST_SCOPE4" | ||
}, | ||
"x-scopes-bindings" : { | ||
"TEST_SCOPE4" : "admin" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"x-wso2-basePath" : "/test_context/0.1" | ||
} |
36 changes: 36 additions & 0 deletions
36
...n.apimgt.impl/src/test/resources/definitions/oas3/default_password_oauth_flow_scopes.yaml
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,36 @@ | ||
openapi: 3.0.1 | ||
info: | ||
title: TEST_API | ||
version: '1.0.0' | ||
servers: | ||
- url: 'https://localhost:8080/test_backend' | ||
security: | ||
- default: [] | ||
paths: | ||
/testpath: | ||
get: | ||
parameters: [] | ||
responses: | ||
'200': | ||
description: ok | ||
security: | ||
- OAuth2Security: | ||
- TEST_SCOPE | ||
x-auth-type: Application & Application User | ||
x-throttling-tier: 10KPerMin | ||
x-wso2-application-security: | ||
security-types: | ||
- oauth2 | ||
optional: false | ||
components: | ||
securitySchemes: | ||
default: | ||
type: oauth2 | ||
flows: | ||
password: | ||
tokenUrl: 'https://localhost:9443/oauth2/token' | ||
scopes: | ||
TEST_SCOPE: 'TEST_SCOPE' | ||
x-scopes-bindings: | ||
TEST_SCOPE: 'admin' | ||
x-wso2-basePath: /test_context/0.1 |
Oops, something went wrong.