GROUPS_FROM_TOKEN Function
This function returns the list of tokens from current social sign in ID or access token. Call this function in the post-authentication logic of an authentication scheme.
Syntax
FUNCTION apex_authentication.groups_from_token (
p_group_names_path_expr IN VARCHAR2 )
RETURN APEX_T_VARCHAR2;
Parameters
| Parameter | Description |
|---|---|
p_group_names_path_expr |
JSON Path expression pointing to the “name” attribute for each group. May contain array steps. Defaults to $.groups[*].name. |
Returns
This function returns a list of group names as APEX_T_VARCHAR2.
Example 1
This example enables all groups from the token as dynamic groups and emits to debug output.
declare
l_group_names apex_t_varchar2;
begin
l_group_names := apex_authentication.groups_from_token(
p_group_names_path_expr => '$.groups[*].name' );
apex_debug.info( 'Dynamic Groups: %s', apex_string.join( l_group_names, ',' );
apex_authorization.enable_dynamic_groups(
p_group_names => l_group_names );
end;
Example 2
This example enables groups having a name containing hr from the token as dynamic groups and emits to debug output.
declare
l_group_names apex_t_varchar2;
begin
l_group_names := apex_authentication.groups_from_token(
p_group_names_path_expr => '$.groups[*]?(@.name like_regex ".*hr.*").name' );
apex_debug.info( 'Dynamic Groups: %s', apex_string.join( l_group_names, ',' );
apex_authorization.enable_dynamic_groups(
p_group_names => l_group_names );
end;