-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Dart] Allow setting an accessToken for OAuth (#7528)
* dart - allow setting an accessToken for oauth * Remove unneeded accessToken member
- Loading branch information
Showing
2 changed files
with
19 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
12 changes: 11 additions & 1 deletion
12
modules/swagger-codegen/src/main/resources/dart/auth/oauth.mustache
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,9 +1,19 @@ | ||
part of {{pubName}}.api; | ||
|
||
class OAuth implements Authentication { | ||
String accessToken; | ||
OAuth({this.accessToken}) { | ||
} | ||
|
||
@override | ||
void applyToParams(List<QueryParam> queryParams, Map<String, String> headerParams) { | ||
// TODO: support oauth | ||
if (accessToken != null) { | ||
headerParams["Authorization"] = "Bearer " + accessToken; | ||
} | ||
} | ||
|
||
void setAccessToken(String accessToken) { | ||
this.accessToken = accessToken; | ||
} | ||
} |