问题
I'm setting up an APEX app using single-sign on following this tutorial and the app now allows sign-in to occur. However the value of APP_USER does not equal the email address that is logged in through Microsoft - it defaults to APEX_PUBLIC_USER. I want to use the username to provide role-based application access control.
I've looked around for solutions and found post authentication code that looks like it should help and I have tried to adapt.
Using
procedure post_authenticate
is
begin
w14_auth_pkh.post_authenticate(
p_username => :APP_USER);
end post_authenticate
or
apex_custom_auth.set_user (p_user => :APP_USER);
I get the following error messages when applying changes from within the authenticate scheme section:
ORA-06550: line 8, column 1: PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: ; The symbol ";" was substituted for "BEGIN" to continue.
or
ORA-06550: line 2, column 17: PLS-00103: Encountered the symbol "." when expecting one of the following: constant exception table columns long double ref char time timestamp interval date binary national character nchar The symbol "" was substituted for "." to continue.
回答1:
You first code sample uses a package of Dimitri's, and is missing a semi-colon at the end.
Your relevant code would be APEX_CUSTOM_AUTH.SET_USER();
Alternatively, you could change the Username attribute to something that has been made available via the user info endpoint URL.
来源:https://stackoverflow.com/questions/56377788/how-do-you-set-the-username-app-user-as-the-email-from-single-sign-on-in-apex