-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: oauth2 support (not sure swagger web can be use)
- Loading branch information
Showing
8 changed files
with
81 additions
and
12 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
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,18 @@ | ||
module Swagger | ||
# OAuth2 Flow Object | ||
struct OAuth2Flow | ||
property name | ||
property authorization_url | ||
property token_url | ||
property refresh_url | ||
property scopes | ||
|
||
def initialize(@name : String, @authorization_url : String? = nil, @token_url : String? = nil, | ||
@refresh_url : String? = nil, @scopes : Hash(String, String)? = nil) | ||
|
||
unless Objects::OAuth2Flow::GRANT_TYPES.includes?(@name) | ||
raise UndefinedOAuth2GrantType.new("Undefined grant type `#{@name}`, avaiabled in #{Objects::OAuth2Flow::GRANT_TYPES}") | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Swagger::Objects | ||
# OAuth2 Flow Object | ||
struct OAuth2Flow | ||
include JSON::Serializable | ||
|
||
GRANT_TYPES = %w(authorizationCode implicit password clientCredentials) | ||
|
||
@[JSON::Field(key: "authorizationUrl")] | ||
getter authorization_url : String? = nil | ||
|
||
@[JSON::Field(key: "tokenUrl")] | ||
getter token_url : String? = nil | ||
|
||
@[JSON::Field(key: "refreshUrl")] | ||
getter refresh_url : String? = nil | ||
getter scopes : Hash(String, String)? = nil | ||
|
||
def initialize(@authorization_url : String? = nil, @token_url : String? = nil, | ||
@refresh_url : String? = nil, @scopes : Hash(String, String)? = nil) | ||
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