* [pve-devel] [PATCH proxmox{_dart_api_client, _login_manager} v2 0/2] fix #6409: login manager doesn't pre-selects default authentication realm
@ 2025-05-26 15:41 Shan Shaji
2025-05-26 15:41 ` [pve-devel] [PATCH proxmox_dart_api_client v2 1/2] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
2025-05-26 15:41 ` [pve-devel] [PATCH proxmox_login_manager v2 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
0 siblings, 2 replies; 6+ messages in thread
From: Shan Shaji @ 2025-05-26 15:41 UTC (permalink / raw)
To: pve-devel
When the `default` property was selected inside the realm of the web UI,
the app's login page was not showing the default realm instead,
it was always showing PAM.
To reproduce, follow the following steps:
on the web UI go to Datacenter -> Realms and edit another realm than
PAM, like PVE. There you can tick the "Default" checkbox. Now go to
the app and try adding the domain, `PAM` will be selected as default.
This patch series fixes the issue by adding the `default` property
to the `PveAccessDomainModel` and implementing the necessary
check in the `_getAccessDomains` function.
proxmox_dart_api_client:
Shan Shaji (1):
fix #6409: add `default` property to `PveAccessDomainModel`
lib/src/models/pve_access_domain_model.dart | 5 +++++
1 file changed, 5 insertions(+)
proxmox_login_manager:
Shan Shaji (1):
fix #6409: add `isDefaultRealm` check to pre-select realm in login
form
lib/proxmox_login_form.dart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Summary over all repositories:
2 files changed, 6 insertions(+), 1 deletions(-)
--
Generated by git-murpp 0.8.1
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH proxmox_dart_api_client v2 1/2] fix #6409: add `default` property to `PveAccessDomainModel`
2025-05-26 15:41 [pve-devel] [PATCH proxmox{_dart_api_client, _login_manager} v2 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
@ 2025-05-26 15:41 ` Shan Shaji
2025-05-26 15:41 ` [pve-devel] [PATCH proxmox_login_manager v2 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
1 sibling, 0 replies; 6+ messages in thread
From: Shan Shaji @ 2025-05-26 15:41 UTC (permalink / raw)
To: pve-devel
When the default property was selected inside the realm
of the web UI, the app's login page was not showing the
default realm instead, it was always showing PAM.
This commit adds the `default` property and creates a getter boolean
that internally checks if the realm is default. This boolean is
used inside `pve_login_form.dart`, which is part of pve_login_manager.
Also the `default` property is named as `defaultValue` as `default` is
a keyword [0] in dart.
- [0] https://dart.dev/language/keywords
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
lib/src/models/pve_access_domain_model.dart | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/src/models/pve_access_domain_model.dart b/lib/src/models/pve_access_domain_model.dart
index 81cb7a4..6298bbe 100644
--- a/lib/src/models/pve_access_domain_model.dart
+++ b/lib/src/models/pve_access_domain_model.dart
@@ -9,6 +9,11 @@ abstract class PveAccessDomainModel
String get realm;
String? get comment;
String? get tfa;
+ @BuiltValueField(wireName: 'default')
+ int? get defaultValue;
+
+ bool get isDefaultRealm => defaultValue == 1;
+
PveAccessDomainModel._();
factory PveAccessDomainModel(
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [pve-devel] [PATCH proxmox_login_manager v2 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form
2025-05-26 15:41 [pve-devel] [PATCH proxmox{_dart_api_client, _login_manager} v2 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
2025-05-26 15:41 ` [pve-devel] [PATCH proxmox_dart_api_client v2 1/2] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
@ 2025-05-26 15:41 ` Shan Shaji
2025-06-03 9:48 ` Michael Köppl
1 sibling, 1 reply; 6+ messages in thread
From: Shan Shaji @ 2025-05-26 15:41 UTC (permalink / raw)
To: pve-devel
When the `default` property was selected inside the realm of the web
UI, the app's login page was not showing the default realm instead,
it was always showing PAM.
This commit adds the `isDefaultRealm` boolean check to find the
default realm.
Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
changes since v1:
* generated the patch again by comparing with master
lib/proxmox_login_form.dart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
index 5916563..4ed495d 100644
--- a/lib/proxmox_login_form.dart
+++ b/lib/proxmox_login_form.dart
@@ -697,7 +697,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
response?.sort((a, b) => a!.realm.compareTo(b!.realm));
final selection = response?.singleWhere(
- (e) => e!.realm == widget.userModel?.realm,
+ (e) => e!.realm == widget.userModel?.realm || e.isDefaultRealm,
orElse: () => response?.first,
);
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pve-devel] [PATCH proxmox_login_manager v2 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form
2025-05-26 15:41 ` [pve-devel] [PATCH proxmox_login_manager v2 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
@ 2025-06-03 9:48 ` Michael Köppl
2025-06-03 10:31 ` Shan Shaji
0 siblings, 1 reply; 6+ messages in thread
From: Michael Köppl @ 2025-06-03 9:48 UTC (permalink / raw)
To: Proxmox VE development discussion, Shan Shaji
On 5/26/25 17:41, Shan Shaji wrote:
> When the `default` property was selected inside the realm of the web
> UI, the app's login page was not showing the default realm instead,
> it was always showing PAM.
>
> This commit adds the `isDefaultRealm` boolean check to find the
> default realm.
nit: commit message should not say "This commit..."
>
> Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
> ---
>
> changes since v1:
> * generated the patch again by comparing with master
>
> lib/proxmox_login_form.dart | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
> index 5916563..4ed495d 100644
> --- a/lib/proxmox_login_form.dart
> +++ b/lib/proxmox_login_form.dart
> @@ -697,7 +697,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
> response?.sort((a, b) => a!.realm.compareTo(b!.realm));
>
> final selection = response?.singleWhere(
> - (e) => e!.realm == widget.userModel?.realm,
> + (e) => e!.realm == widget.userModel?.realm || e.isDefaultRealm,
This change will make the singleWhere throw a StateError "too many
elements" if the user was already signed in on an instance with a realm
different from the default realm and tries to connect to their PVE host
again. singleWhere expects a single element to fulfill the condition. If
multiple do it, it causes an exception. In this case, one realm would
match the user's selected realm and another would match the default realm.
To make it more clear what I mean:
- Sign into a PVE host using PAM
- Change the default realm to "PVE" in the web UI
- Sign out from the PVE host in the app (do not delete the site)
- Try to sign in again. Progress spinner with "Connecting..." since the
exception is uncaught.
I think the logic for this would have to be more along the lines of:
final selection = response?.singleWhere(
(e) {
if (widget.userModel?.realm != null) {
return e!.realm == widget.userModel?.realm;
} else {
return e!.isDefaultRealm;
}
},
orElse: () => response?.first,
);
This gives priority to the user's selection if there is one.
> orElse: () => response?.first,
> );
>
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pve-devel] [PATCH proxmox_login_manager v2 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form
2025-06-03 9:48 ` Michael Köppl
@ 2025-06-03 10:31 ` Shan Shaji
2025-06-03 12:24 ` Shan Shaji
0 siblings, 1 reply; 6+ messages in thread
From: Shan Shaji @ 2025-06-03 10:31 UTC (permalink / raw)
To: Michael Köppl, Proxmox VE development discussion
Thank you for catching that. Will create another patch.
On Tue Jun 3, 2025 at 11:48 AM CEST, Michael Köppl wrote:
> On 5/26/25 17:41, Shan Shaji wrote:
> > When the `default` property was selected inside the realm of the web
> > UI, the app's login page was not showing the default realm instead,
> > it was always showing PAM.
> >
> > This commit adds the `isDefaultRealm` boolean check to find the
> > default realm.
>
> nit: commit message should not say "This commit..."
>
> >
> > Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
> > ---
> >
> > changes since v1:
> > * generated the patch again by comparing with master
> >
> > lib/proxmox_login_form.dart | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
> > index 5916563..4ed495d 100644
> > --- a/lib/proxmox_login_form.dart
> > +++ b/lib/proxmox_login_form.dart
> > @@ -697,7 +697,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
> > response?.sort((a, b) => a!.realm.compareTo(b!.realm));
> >
> > final selection = response?.singleWhere(
> > - (e) => e!.realm == widget.userModel?.realm,
> > + (e) => e!.realm == widget.userModel?.realm || e.isDefaultRealm,
>
> This change will make the singleWhere throw a StateError "too many
> elements" if the user was already signed in on an instance with a realm
> different from the default realm and tries to connect to their PVE host
> again. singleWhere expects a single element to fulfill the condition. If
> multiple do it, it causes an exception. In this case, one realm would
> match the user's selected realm and another would match the default realm.
>
> To make it more clear what I mean:
> - Sign into a PVE host using PAM
> - Change the default realm to "PVE" in the web UI
> - Sign out from the PVE host in the app (do not delete the site)
> - Try to sign in again. Progress spinner with "Connecting..." since the
> exception is uncaught.
>
> I think the logic for this would have to be more along the lines of:
>
> final selection = response?.singleWhere(
> (e) {
> if (widget.userModel?.realm != null) {
> return e!.realm == widget.userModel?.realm;
> } else {
> return e!.isDefaultRealm;
> }
> },
> orElse: () => response?.first,
> );
>
> This gives priority to the user's selection if there is one.
> > orElse: () => response?.first,
> > );
> >
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [pve-devel] [PATCH proxmox_login_manager v2 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form
2025-06-03 10:31 ` Shan Shaji
@ 2025-06-03 12:24 ` Shan Shaji
0 siblings, 0 replies; 6+ messages in thread
From: Shan Shaji @ 2025-06-03 12:24 UTC (permalink / raw)
To: Proxmox VE development discussion, Michael Köppl
superseeded by v3:
https://lore.proxmox.com/pve-devel/20250603122037.158232-1-s.shaji@proxmox.com/T/#t
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-03 12:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-26 15:41 [pve-devel] [PATCH proxmox{_dart_api_client, _login_manager} v2 0/2] fix #6409: login manager doesn't pre-selects default authentication realm Shan Shaji
2025-05-26 15:41 ` [pve-devel] [PATCH proxmox_dart_api_client v2 1/2] fix #6409: add `default` property to `PveAccessDomainModel` Shan Shaji
2025-05-26 15:41 ` [pve-devel] [PATCH proxmox_login_manager v2 2/2] fix #6409: add `isDefaultRealm` check to pre-select realm in login form Shan Shaji
2025-06-03 9:48 ` Michael Köppl
2025-06-03 10:31 ` Shan Shaji
2025-06-03 12:24 ` Shan Shaji
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.