-
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.
Refactor setting default Oauth2 values
- Loading branch information
Zuzanna Stolińska
committed
Aug 3, 2017
1 parent
1f1afc0
commit 553303d
Showing
3 changed files
with
19 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,12 @@ | ||
module SwaggerUiEngine | ||
module OauthConfigParser | ||
def set_oauth_app_name | ||
configuration.oauth_app_name || 'your-app-name' | ||
end | ||
|
||
def set_oauth_client_id | ||
configuration.oauth_client_id || 'your-client-id' | ||
end | ||
|
||
def set_oauth_client_secret | ||
configuration.oauth_client_secret || 'your-client-secret-if-required' | ||
end | ||
|
||
def set_oauth_realm | ||
configuration.oauth_realm || 'your-realms' | ||
end | ||
|
||
def set_oauth_scope_separator | ||
configuration.oauth_scope_separator || ' ' | ||
end | ||
|
||
def set_oauth_query_string_params | ||
configuration.oauth_query_string_params || {} | ||
end | ||
|
||
def configuration | ||
SwaggerUiEngine.configuration | ||
SwaggerUiEngine::OAUTH2_DEFAULTS.each do |default| | ||
define_method("set_#{default.first}") do | ||
# set_oauth_app_name set_oauth_client_id | ||
# set_oauth_client_secret set_oauth_realm | ||
# set_oauth_scope_separator set_oauth_query_string_params | ||
configuration.send("#{default.first}") || default.last | ||
end | ||
end | ||
end | ||
end |
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