| Oracle Application Server Portal PL/SQL API Reference - 10.1.4 | |||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||
| SUMMARY: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | DETAIL: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | |||||||
This package contains methods to check user access privileges before routines are executed, and to redirect browsers to the Single Sign-On Server when authentication is necessary.
Application must make a check_privilege call before executing routines because OracleAS Portal 10G implements a single DAD concept. Therefore all login routines are done through the Single Sign-On Server.
When mod_plsql receives a request for a procedure, it is able to invoke the procedure as long as the package is accessible to PUBLIC in general, and to the database schema to which the user is mapped, in particular. This procedure then, should perform access control checks to determine if the user has appropriate access rights.
Note: All procedures and functions in packages granted to PUBLIC or to a database schema mapped to the PUBLIC portal user, must make this check before further processing if they require specific privileges to be executed. For more information, see Check privilege function logic.
For information about privilege constants referenced when using wwsec_app_priv APIs, see wwa_api_privilege global privilege objects.
| Function/Procedure Summary | |
check_if_logged_on | boolean |
check_privilege | boolean |
check_privilege | boolean |
check_privilege | boolean |
get_login_link | varchar2 |
get_login_url | varchar2 |
get_logout_link | varchar2 |
get_logout_url | varchar2 |
get_portal_login_link_text | varchar2 |
get_portal_login_url | varchar2 |
get_req_url_for_site2pstore | varchar2 |
login | |
logout | |
process_signon | |
retrieve_requested_url | varchar2 |
| Function/Procedure Detail |
function check_if_logged_on(
p_requested_url in varchar2 default wwctx_api . get_product_schema || '.home'
) return booleanExample:
if wwsec_app_priv.check_if_logged_on
(
p_requested_url => wwctx_api.get_product_schema || '.this_procedure'
)
then...
p_requested_url - the URL that the user is attempting to access.
Note that:
function check_privilege(
p_object in varchar2,
p_privilege in varchar2,
p_name in varchar2,
p_auto_redirect in boolean default true,
p_requested_url in varchar2 default wwctx_api . get_product_schema || '.home',
p_owner in varchar2 default wwctx_api . get_product_schema,
p_reqd_auth_level in number default wwctx_api . required_authentication_level
) return booleanIf the user does not have the right privilege, it could mean that the user is not logged on and that the PUBLIC user does not have the necessary privilege. Alternatively, a logged on user may simply not have sufficient privileges.
In the first case, the user should login. In the second case, an appropriate message is displayed to the user.
Example:
procedure display_user_mgr ( ... )
begin
-- always begin with a privilege check
if wwsec_app_priv.check_privilege
(
p_object => wwsec_api.PAGE_OBJ,
p_privilege => wwsec_api.VIEW_PRIV,
p_name => '0/156',
p_requested_url => wwctx_api.get_product_schema||
'.wwsec_app_user_mgr.display_user_mgr',
p_reqd_auth_level => wwctx_api.REQUIRED_AUTHENTICATION_LEVEL
)
then
-- will not reach here if no privileges...
-- privileged application code may follow
...
end if;
end display_user_mgr;
p_object - the type of object being securedp_privilege - the privilege name being checkedp_name - a unique identifier for the specified object instancep_auto_redirect - indicates if the screen should display the
Login Page if a user is not logged in and does not have sufficient
privileges in PUBLIC mode to access the object. If TRUE is
returned, the user is redirected to the Login Page. p_requested_url - the URL of the object for which privileges
are being checked. Note that the p_requested_url parameter should
point the user's browser to the page to be displayed
after successful authorization.p_owner - the name of the schema that owns the p_name objectp_reqd_auth_level - the minimum authentication level that a
calling function requires in order to pass a privilege check.
function check_privilege(
p_object in varchar2,
p_privilege_array in wwsec_api.array,
p_name in varchar2,
p_auto_redirect in boolean default true,
p_requested_url in varchar2 default wwctx_api . get_product_schema || '.home',
p_owner in varchar2 default wwctx_api . get_product_schema,
p_reqd_auth_level in number default wwctx_api . required_authentication_level
) return booleanExample:
l_priv_array wwsec_api.array;
l_priv_array(1):= wwsec_api.PAGE_PRIV;
if wwsec_app_priv.check_privilege
(
p_object => wwsec_api.PAGE_OBJ,
p_privilege_array => l_priv_array,
p_name => '0/156',
p_requested_url => wwctx_api.get_product_schema ||'
.wwsec_app_user_mgr.display_user_mgr'
)
then...
p_object - the type of object being securedp_privilege_array - the list of privilege names being checked.
Note that these names are specified with privilege name
constants of the wwsec_api package.p_name - a unique identifier for the specified object instancep_auto_redirect - indicates if the screen should display the
Login Page if a user is not logged in and does not have
sufficient privileges in PUBLIC mode to access the object.
If TRUE is returned, the user is redirected to the Login Page.
p_requested_url - the URL of the object for which privileges
are being checked. Note that the p_requested_url parameter
should point the user's browser to the page to be displayed
after successful authorization.p_owner - the name of the schema that owns the p_name objectp_reqd_auth_level - the minimum authentication level that a
calling function requires in order to pass a privilege check.
function check_privilege(
p_object in varchar2,
p_privilege_code in number,
p_name in varchar2,
p_auto_redirect in boolean default true,
p_requested_url in varchar2 default wwctx_api . get_product_schema || '.home',
p_owner in varchar2 default wwctx_api . get_product_schema,
p_reqd_auth_level in number default wwctx_api . required_authentication_level
) return booleanNote: A typical use would be to learn if a user has a VIEW privilege for a particular folder.
Example:
if wwsec_app_priv.check_privilege
(
p_object => wwsec_api.PAGE_OBJ,
p_privilege_code => wwsec_api.PAGE_VIEW,
p_name => '0/156',
p_requested_url => wwctx_api.get_product_schema ||'
.wwsec_app_user_mgr.display_user_mgr'
)
then...
p_object - the type of object being securedp_privilege_code - the privilege code being checked. Set this
parameter to the minimum privilege code the user should have to
access the object.p_name - a unique identifier for the specified object instancep_auto_redirect - indicates if the screen should display the
Login Page if a user is not logged in and does not have
sufficient privileges in PUBLIC mode to access the object.
If TRUE is returned, the user is redirected to the
Login Page. p_requested_url - the URL of the object for which privileges
are being checked. Note that the p_requested_url parameter should
point the user's browser to the page to be displayed
after successful authorization.p_owner - the name of the schema that owns the p_name objectp_reqd_auth_level - the minimum authentication level that a
calling function requires in order to pass a privilege check.
function get_login_link(
p_nls_link_text in varchar2 default null,
p_image_filename in varchar2 default null,
p_requested_url in varchar2 default wwctx_api . get_product_schema || '.home'
) return varchar2Example:
htp.htmlopen;
htp.bodyopen;
htp.p
(
wwsec_app_privs.get_login_link(
p_nls_link_text => wwnls_api.get_string(
p_domain => 'research',
p_sub_domain => 'main',
p_language => 'us',
p_name => 'login_link_text'
),
p_image_filename => wwctx_api.get_image_path('login.gif'),
p_requested_url => wwctx_api.get_product_schema || '.home'
)
);
htp.bodyclose;
htp.htmlclose;
p_nls_link_text - optional text that is used as the hyperlink
text if the format CONTENT_TYPE_HTML is specified. Note that this
text should be in the NLS language requested by the user.p_image_filename - an optional image filename and path
for inclusion in an image tag to use for the Login link. The
default (null) results in a simple text link. Note that when this
parameter is specified, the nls_link_text is used as alternative
(mouseover) text, i.e. Alt text.p_requested_url - an optional parameter indicating the URL
that you want to be redirected to upon successful authentication.
Note that this parameter allows an application to specify
a page to be redirected to upon successful authentication.
function get_login_url(
p_requested_url in varchar2 default wwctx_api . get_product_schema || '.home',
p_cancel_url in varchar2 default wwctx_api . get_product_schema || '.home'
) return varchar2Example:
declare
l_url varchar2(100);
begin
l_url := wwsec_app_priv.get_login_url
end;
p_requested_url - the URL (page) to be displayed upon successful
authenticationp_cancel_url - the URL (page) to be displayed when the user
cancels authentication
function get_logout_link(
p_nls_link_text in varchar2 default null,
p_image_filename in varchar2 default null,
p_done_url in varchar2 default wwctx_api . get_product_schema || '.home'
) return varchar2Example:
if wwctx_api.is_logged_on then
wwsec_app_priv.get_logout_link
(
p_done_url => 'home'
);
...
p_nls_link_text - the translated text to be displayed
for the Logout linkp_image_filename - the image to be displayed for the
Logout linkp_done_url - the page to display after logging out
function get_logout_url(
p_done_url in varchar2 default wwctx_api . get_product_schema || '.home'
) return varchar2Example:
begin
htp.anchor
(
curl => wwsec_app_priv.get_logout_url,
ctext => wwsec_ui.nls ('logout_link_text')
);
end;
p_done_url - the URL of the page to be displayed after
the user logs outfunction get_portal_login_link_text return varchar2
Example:
begin
htp.anchor
(
curl => wwsec_app_priv.get_portal_login_url,
ctext => wwsec_app_priv.get_portal_login_link_text
);
end;
function get_portal_login_url(
p_requested_url in varchar2 default wwctx_api . get_proc_path ( p_url => 'home' ),
p_cancel_url in varchar2 default wwctx_api . get_proc_path ( p_url => 'home' )
) return varchar2Example:
begin
htp.anchor
(
curl => wwsec_app_priv.get_portal_login_url,
ctext => wwsec_app_priv.get_portal_login_link_text
);
end;
p_requested_url - the URL of the user Login Page.
This parameter allows an application to specify a page to be
displayed after authentication.p_cancel_url - the URL of the page to be displayed when
the user cancels authentication
function get_req_url_for_site2pstore(
p_requested_url in varchar2
) return varchar2p_requested_url - It is passed into this function, and evaluated to see for the
above mentioned cases. In case the above conditions is
satisfied then the requested url is held in the session store
and a place holder url is returned. Otherwise the value passed
in is returned.
procedure login(
p_requested_url in varchar2 default wwctx_api . get_product_schema || '.home',
p_cancel_url in varchar2 default wwctx_api . get_product_schema || '.home',
p_forced_authentication in boolean default false
) Example:
if not wwctx_api.is_logged_on
then
wwsec_app_priv.login
(
p_requested_url => l_requested_url
);
...
p_requested_url - the URL of the object for which privileges
are being checkedp_cancel_url - specifies a page to be displayed when the
user cancels authenticationp_forced_authentication - is it a request for forced authentication?
TRUE: forced_authentication, FALSE: regular authenticationprocedure logout
This procedure is intended to be called from the Single Sign-On Server doing a global logout.
procedure process_signon(
urlc in varchar2
) urlc - the authentication token passed from the Single Sign-On
Server after successful authentication
function retrieve_requested_url(
p_requested_url in varchar2
) return varchar2This procedure is used by process_signon in OracleAS Portal 10G and the Single Sign-On Server to retrieve the requested URL from the session storage if it was null in the parse_url_cookie. This is because in some cases, the URL becomes too large to be passed in site2pstoretoken, causing problems in Internet Explorer (IE). So, in these cases, the URL is kept in session storage for later retrieval. This is done only when necessary in order to remain as performant as possible.
Example:
l_requested_url := wwsec_app_priv.retrieve_requested_url(
p_requested_url => l_requested_url
);
p_requested_url - this is the value of the p_requested_url
parsed out from the urlc from process_signon. It is passed
into this function, and evaluated to see if it indicates that
the actual value should be obtained from the session store,
and if so, the value in session storage is returned. Otherwise
the value passed in is returned.
| Oracle Application Server Portal PL/SQL API Reference - 10.1.4 | |||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||
| SUMMARY: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | DETAIL: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | |||||||