-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
91 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.0.3 | ||
|
||
- Supports discovery | ||
|
||
## 0.0.2 | ||
|
||
- Adds token revocation support | ||
|
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 |
---|---|---|
@@ -1,30 +1,45 @@ | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'oauth2_endpoints.g.dart'; | ||
|
||
/// Wrapper for all OAuth2 endpoints | ||
@JsonSerializable() | ||
class OAuth2Endpoints { | ||
/// URI for authorization | ||
final Uri authorize; | ||
@JsonKey(name: 'authorization_endpoint') | ||
final Uri authorization; | ||
|
||
/// URI for token exchange | ||
@JsonKey(name: 'token_endpoint') | ||
final Uri token; | ||
|
||
/// URI for token revocation | ||
final Uri revoke; | ||
@JsonKey(name: 'revocation_endpoint') | ||
final Uri? revocation; | ||
|
||
/// Construct with explicit URLs | ||
OAuth2Endpoints({ | ||
required String authorize, | ||
required String authorization, | ||
required String token, | ||
required String revoke, | ||
}) : authorize = Uri.parse(authorize), | ||
String? revocation, | ||
}) : authorization = Uri.parse(authorization), | ||
token = Uri.parse(token), | ||
revoke = Uri.parse(revoke); | ||
revocation = revocation != null ? Uri.parse(revocation) : null; | ||
|
||
/// Construct with a base URL | ||
/// | ||
/// Convenient for services that have a consistent base URL | ||
OAuth2Endpoints.base(String base) | ||
: this( | ||
authorize: '$base/authorize', | ||
authorization: '$base/authorize', | ||
token: '$base/token', | ||
revoke: '$base/revoke', | ||
revocation: '$base/revoke', | ||
); | ||
|
||
/// From json | ||
factory OAuth2Endpoints.fromJson(Map<String, dynamic> json) => | ||
_$OAuth2EndpointsFromJson(json); | ||
|
||
/// To json | ||
Map<String, dynamic> toJson() => _$OAuth2EndpointsToJson(this); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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