From 10b7ca41af8cfe791787fb747c4b1b65d2fefeca Mon Sep 17 00:00:00 2001 From: Valentin Michalak Date: Tue, 10 Jun 2025 17:27:34 +0200 Subject: [PATCH 1/2] Add `Prompt` class to expose all prompt defined in OpenID Connect 1.0 specs --- flutter_appauth/lib/flutter_appauth.dart | 2 ++ .../flutter_appauth_platform_interface.dart | 1 + .../lib/src/prompt.dart | 35 +++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 flutter_appauth_platform_interface/lib/src/prompt.dart diff --git a/flutter_appauth/lib/flutter_appauth.dart b/flutter_appauth/lib/flutter_appauth.dart index c8aeeff7..0ea2ac94 100644 --- a/flutter_appauth/lib/flutter_appauth.dart +++ b/flutter_appauth/lib/flutter_appauth.dart @@ -13,6 +13,8 @@ export 'package:flutter_appauth_platform_interface/flutter_appauth_platform_inte FlutterAppAuthUserCancelledException, FlutterAppAuthPlatformException, GrantType, + Prompt, TokenRequest, TokenResponse; + export 'src/flutter_appauth.dart'; diff --git a/flutter_appauth_platform_interface/lib/flutter_appauth_platform_interface.dart b/flutter_appauth_platform_interface/lib/flutter_appauth_platform_interface.dart index b2860ac6..7039340c 100644 --- a/flutter_appauth_platform_interface/lib/flutter_appauth_platform_interface.dart +++ b/flutter_appauth_platform_interface/lib/flutter_appauth_platform_interface.dart @@ -9,5 +9,6 @@ export 'src/errors.dart'; export 'src/external_user_agent.dart'; export 'src/flutter_appauth_platform.dart'; export 'src/grant_type.dart'; +export 'src/prompt.dart'; export 'src/token_request.dart'; export 'src/token_response.dart'; diff --git a/flutter_appauth_platform_interface/lib/src/prompt.dart b/flutter_appauth_platform_interface/lib/src/prompt.dart new file mode 100644 index 00000000..6fa54f67 --- /dev/null +++ b/flutter_appauth_platform_interface/lib/src/prompt.dart @@ -0,0 +1,35 @@ +/// All spec-defined values for the OpenID Connect 1.0 `prompt` parameter. +/// +/// See OpenID Connect Core 1.0, Section 3.1.2.1 for more infos: +/// https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.3.1.2.1 +class Prompt { + /// The Authorization Server MUST NOT display any authentication or consent + /// user interface pages. An error is returned if an End-User is not already + /// authenticated or the Client does not have pre-configured consent for the + /// requested Claims or does not fulfill other conditions for processing the + /// request. The error code will typically be `login_required`, + /// `interaction_required`, or another code defined in + /// [OpenID Connect Core 1.0, Section 3.1.2.6]( + /// https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.3.1.2.6). + /// This can be used as a method to check for existing authentication and/or + /// consent. + static const String none = 'none'; + + /// The Authorization Server SHOULD prompt the End-User for re-authentication. + /// If it cannot re-authenticate the End-User, it MUST return an error, + /// typically `login_required`. + static const String login = 'login'; + + /// The Authorization Server SHOULD prompt the End-User for consent before + /// returning information to the Client. If it cannot obtain consent, it MUST + /// return an error, typically `consent_required`. + static const String consent = 'consent'; + + /// The Authorization Server SHOULD prompt the End-User to select a user + /// account. This enables an End-User who has multiple accounts at the + /// Authorization Server to select amongst the multiple accounts that they + /// might have current sessions for. If it cannot obtain an account selection + /// choice made by the End-User, it MUST return an error, typically + /// `account_selection_required`. + static const String selectAccount = 'select_account'; +} From 6dd2f6f8f334383ff259587383414d2e31af43aa Mon Sep 17 00:00:00 2001 From: Michael Bui <25263378+MaikuB@users.noreply.github.com> Date: Sun, 26 Oct 2025 19:58:51 +1100 Subject: [PATCH 2/2] apply requested API doc changes --- .../lib/src/prompt.dart | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/flutter_appauth_platform_interface/lib/src/prompt.dart b/flutter_appauth_platform_interface/lib/src/prompt.dart index 6fa54f67..9533b57d 100644 --- a/flutter_appauth_platform_interface/lib/src/prompt.dart +++ b/flutter_appauth_platform_interface/lib/src/prompt.dart @@ -1,10 +1,12 @@ /// All spec-defined values for the OpenID Connect 1.0 `prompt` parameter. /// -/// See OpenID Connect Core 1.0, Section 3.1.2.1 for more infos: +/// See OpenID Connect Core 1.0, Section 3.1.2.1 for more information: /// https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.3.1.2.1 class Prompt { /// The Authorization Server MUST NOT display any authentication or consent - /// user interface pages. An error is returned if an End-User is not already + /// user interface pages. + /// + /// An error is returned if an End-User is not already /// authenticated or the Client does not have pre-configured consent for the /// requested Claims or does not fulfill other conditions for processing the /// request. The error code will typically be `login_required`, @@ -16,17 +18,22 @@ class Prompt { static const String none = 'none'; /// The Authorization Server SHOULD prompt the End-User for re-authentication. + /// /// If it cannot re-authenticate the End-User, it MUST return an error, /// typically `login_required`. static const String login = 'login'; /// The Authorization Server SHOULD prompt the End-User for consent before - /// returning information to the Client. If it cannot obtain consent, it MUST + /// returning information to the Client. + /// + /// If it cannot obtain consent, it MUST /// return an error, typically `consent_required`. static const String consent = 'consent'; /// The Authorization Server SHOULD prompt the End-User to select a user - /// account. This enables an End-User who has multiple accounts at the + /// account. + /// + /// This enables an End-User who has multiple accounts at the /// Authorization Server to select amongst the multiple accounts that they /// might have current sessions for. If it cannot obtain an account selection /// choice made by the End-User, it MUST return an error, typically