Skip to content

Commit

Permalink
Support x_authentication_flow_group in authz request
Browse files Browse the repository at this point in the history
  • Loading branch information
IniZio committed Apr 17, 2024
1 parent 3c06798 commit 7fe0b69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class OIDCAuthenticationRequest {
final AuthenticationPage? page;
final String? wechatRedirectURI;
final SettingsAction? settingsAction;
final String? xAuthenticationFlowGroup;

OIDCAuthenticationRequest({
required this.clientID,
Expand All @@ -40,6 +41,7 @@ class OIDCAuthenticationRequest {
this.page,
this.wechatRedirectURI,
this.settingsAction,
this.xAuthenticationFlowGroup,
});

Map<String, String> toQueryParameters() {
Expand Down Expand Up @@ -122,6 +124,11 @@ class OIDCAuthenticationRequest {
q["x_settings_action"] = settingsAction.value;
}

final xAuthenticationFlowGroup = this.xAuthenticationFlowGroup;
if (xAuthenticationFlowGroup != null) {
q["x_authentication_flow_group"] = xAuthenticationFlowGroup;
}

return q;
}
}
Expand Down
10 changes: 10 additions & 0 deletions lib/src/container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class AuthenticateOptions {
final ColorScheme? colorScheme;
final String? wechatRedirectURI;
final AuthenticationPage? page;
final String? xAuthenticationFlowGroup;

AuthenticateOptions({
required this.redirectURI,
Expand All @@ -64,6 +65,7 @@ class AuthenticateOptions {
this.colorScheme,
this.wechatRedirectURI,
this.page,
this.xAuthenticationFlowGroup,
});

OIDCAuthenticationRequest toRequest(String clientID, CodeVerifier verifier) {
Expand All @@ -85,6 +87,7 @@ class AuthenticateOptions {
state: state,
loginHint: loginHint,
wechatRedirectURI: wechatRedirectURI,
xAuthenticationFlowGroup: xAuthenticationFlowGroup,
);
}
}
Expand All @@ -97,6 +100,7 @@ class ReauthenticateOptions {
final ColorScheme? colorScheme;
final String? wechatRedirectURI;
final int? maxAge;
final String? xAuthenticationFlowGroup;

ReauthenticateOptions({
required this.redirectURI,
Expand All @@ -106,6 +110,7 @@ class ReauthenticateOptions {
this.colorScheme,
this.wechatRedirectURI,
this.maxAge,
this.xAuthenticationFlowGroup,
});

OIDCAuthenticationRequest toRequest(
Expand All @@ -125,6 +130,7 @@ class ReauthenticateOptions {
idTokenHint: idTokenHint,
maxAge: maxAge,
wechatRedirectURI: wechatRedirectURI,
xAuthenticationFlowGroup: xAuthenticationFlowGroup,
);
return oidcRequest;
}
Expand Down Expand Up @@ -287,6 +293,7 @@ class Authgear implements AuthgearHttpClientDelegate {
AuthenticationPage? page,
String? state,
String? wechatRedirectURI,
String? xAuthenticationFlowGroup,
}) async {
final authRequest =
await internalCreateAuthenticateRequest(AuthenticateOptions(
Expand All @@ -298,6 +305,7 @@ class Authgear implements AuthgearHttpClientDelegate {
colorScheme: colorScheme,
wechatRedirectURI: wechatRedirectURI,
page: page,
xAuthenticationFlowGroup: xAuthenticationFlowGroup,
));

if (wechatRedirectURI != null) {
Expand Down Expand Up @@ -339,6 +347,7 @@ class Authgear implements AuthgearHttpClientDelegate {
String? wechatRedirectURI,
BiometricOptionsIOS? biometricIOS,
BiometricOptionsAndroid? biometricAndroid,
String? xAuthenticationFlowGroup,
}) async {
final biometricEnabled = await isBiometricEnabled();
if (biometricEnabled && biometricIOS != null && biometricAndroid != null) {
Expand All @@ -361,6 +370,7 @@ class Authgear implements AuthgearHttpClientDelegate {
colorScheme: colorScheme,
wechatRedirectURI: wechatRedirectURI,
maxAge: maxAge,
xAuthenticationFlowGroup: xAuthenticationFlowGroup,
);

final request =
Expand Down

0 comments on commit 7fe0b69

Please sign in to comment.