Index: openacs-4/packages/xooauth/tcl/authorize-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xooauth/tcl/authorize-procs.tcl,v diff -u -N -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/xooauth/tcl/authorize-procs.tcl 8 May 2023 17:37:52 -0000 1.1.2.1 +++ openacs-4/packages/xooauth/tcl/authorize-procs.tcl 9 May 2023 10:03:56 -0000 1.1.2.2 @@ -112,9 +112,15 @@ return [expr {$user_id eq "" ? 0 : $user_id}] } + :method required_fields {} { + return [expr {${:create_not_registered_users} + ? "email given_name family_name" + : "email"}] + } + :method get_required_fields { {-claims:required} - {-required_fields:required} + {-mapped_fields:required} } { # # Check, if required fields are provided in the claims and @@ -123,17 +129,21 @@ # set result "" - foreach pair $required_fields { + set fields {} + foreach pair $mapped_fields { lassign $pair field target - if {![dict exists $claims $field] - || [dict get $claims $field] in {"" "null"} + dict set fields $target [dict get $claims $field] + } + dict set result fields $fields + foreach field [:required_fields] { + if {![dict exists $fields $field] + || [dict get $fields $field] in {"" "null"} } { set not_enough_data $field break } - dict set result fields $target [dict get $claims $field] } - + if {[info exists not_enough_data]} { ns_log warning "[self] get_user_data: not enough data:" \ $not_enough_data "is missing" @@ -329,7 +339,7 @@ if {![dict exists $result error]} { set data [:get_required_fields \ -claims [dict get $result claims] \ - -required_fields { + -mapped_fields { {email email} {name name} }] Index: openacs-4/packages/xooauth/tcl/ms-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xooauth/tcl/ms-procs.tcl,v diff -u -N -r1.1.2.17 -r1.1.2.18 --- openacs-4/packages/xooauth/tcl/ms-procs.tcl 8 May 2023 17:37:52 -0000 1.1.2.17 +++ openacs-4/packages/xooauth/tcl/ms-procs.tcl 9 May 2023 10:03:56 -0000 1.1.2.18 @@ -1194,7 +1194,7 @@ set data [:get_required_fields \ -claims $claims \ - -required_fields { + -mapped_fields { {upn email} {family_name last_name} {given_name first_names}