{"id":421,"date":"2022-07-15T10:45:58","date_gmt":"2022-07-15T10:45:58","guid":{"rendered":"http:\/\/wp.chaoyu.nl\/?p=421"},"modified":"2022-07-15T14:33:22","modified_gmt":"2022-07-15T14:33:22","slug":"oracle-apex-ords-oauth2-notes","status":"publish","type":"post","link":"https:\/\/chaoyu.nl\/?p=421","title":{"rendered":"Oracle APEX Ords Oauth2 Notes"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/wp.chaoyu.nl\/wp-content\/uploads\/2022\/07\/e56ed0_b67b96aeaabc48e391745eb54bba2e82_mv2.png\" alt=\"\" class=\"wp-image-424\" width=\"839\" height=\"369\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote has-very-light-gray-to-cyan-bluish-gray-gradient-background has-background is-layout-flow wp-block-quote-is-layout-flow\"><p>Create Role<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code lang=\"sql\" class=\"language-sql line-numbers\">BEGIN\n  ORDS.create_role(\n    p_role_name =&gt; 'emp_role'\n  );  \n  COMMIT;\nEND;\n\/<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator aligncenter has-alpha-channel-opacity\"\/>\n\n\n\n<blockquote class=\"wp-block-quote has-very-light-gray-to-cyan-bluish-gray-gradient-background has-background is-layout-flow wp-block-quote-is-layout-flow\"><p>Create Privilege assign role to privilege<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code lang=\"sql\" class=\"language-sql line-numbers\">BEGIN\n  ORDS.create_privilege(\n      p_name        =&gt; 'emp_priv',\n      p_role_name   =&gt; 'emp_role',\n      p_label       =&gt; 'EMP Data',\n      p_description =&gt; 'Allow access to the EMP data.');\n   \n  COMMIT;\nEND;\n\/<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<blockquote class=\"wp-block-quote is-style-default has-very-light-gray-to-cyan-bluish-gray-gradient-background has-background is-layout-flow wp-block-quote-is-layout-flow\"><p>Map privilege to pattern (modules\/ parent end point ) defined in apex or with plsql api<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql line-numbers\">BEGIN\n  ORDS.create_privilege_mapping(\n      p_privilege_name =&gt; 'emp_priv',\n      p_pattern        =&gt; '\/employees\/*');    \n  COMMIT;\nEND;\n\/<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/wp.chaoyu.nl\/wp-content\/uploads\/2022\/07\/e56ed0_4f586489606d4dc2b41956b72bb48ad6_mv2.png\" alt=\"\" class=\"wp-image-437\" width=\"839\" height=\"328\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote has-very-light-gray-to-cyan-bluish-gray-gradient-background has-background is-layout-flow wp-block-quote-is-layout-flow\"><p>Create Client and give privilege created earlier<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql line-numbers\">BEGIN\n  OAUTH.create_client(\n    p_name            =&gt; 'emp_client',\n    p_grant_type      =&gt; 'client_credentials',\n    p_owner           =&gt; 'My Company Limited',\n    p_description     =&gt; 'A client for Emp management',\n    p_support_email   =&gt; 'tim@example.com',\n    p_privilege_names =&gt; 'emp_priv'\n  );\n  COMMIT;\nEND;\n\/<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote has-very-light-gray-to-cyan-bluish-gray-gradient-background has-background is-layout-flow wp-block-quote-is-layout-flow\"><p>Grant Role to Client<\/p><\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql line-numbers\">BEGIN\n  OAUTH.grant_client_role(\n    p_client_name =&gt; 'emp_client',\n    p_role_name   =&gt; 'emp_role'\n  );\n  COMMIT;\nEND;\n\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Get Client_Id and Client_secret<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql line-numbers\">SELECT id\n     , name\n     , client_id\n     , client_secret\nFROM   user_ords_clients;<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-style-default has-blush-bordeaux-gradient-background has-background is-layout-flow wp-block-quote-is-layout-flow\"><p>Test in Postman<\/p><\/blockquote>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"491\" height=\"602\" src=\"http:\/\/wp.chaoyu.nl\/wp-content\/uploads\/2022\/07\/e56ed0_cb479813efab4aeba193a74a5f0d2621_mv2.png\" alt=\"\" class=\"wp-image-443\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">newer version of postman =&gt;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/wp.chaoyu.nl\/wp-content\/uploads\/2022\/07\/e56ed0_70b80978827f4db7a8743c43c253cc17_mv2.png\" alt=\"\" class=\"wp-image-445\" width=\"839\" height=\"584\"\/><\/figure>\n\n\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"464\" height=\"444\" src=\"http:\/\/wp.chaoyu.nl\/wp-content\/uploads\/2022\/07\/ords-oauth-credentials-flow.png\" alt=\"\" class=\"wp-image-451\"\/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.jmjcloud.com\/blog\/ords-securing-services-using-oauth2-2-legged\" data-type=\"URL\" data-id=\"https:\/\/www.jmjcloud.com\/blog\/ords-securing-services-using-oauth2-2-legged\" target=\"_blank\" rel=\"noreferrer noopener\">Read more here.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create Role Create Privilege assign role to privilege Map privilege to pattern (modules\/ parent end point ) defined in apex or with plsql api Create Client and give privilege created earlier Grant Role to Client Get Client_Id and Client_secret Test in Postman newer version of postman =&gt; Read more here.<\/p>\n","protected":false},"author":1,"featured_media":424,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,10],"tags":[],"class_list":["post-421","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apex","category-pl-sql"],"_links":{"self":[{"href":"https:\/\/chaoyu.nl\/index.php?rest_route=\/wp\/v2\/posts\/421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chaoyu.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chaoyu.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chaoyu.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chaoyu.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=421"}],"version-history":[{"count":27,"href":"https:\/\/chaoyu.nl\/index.php?rest_route=\/wp\/v2\/posts\/421\/revisions"}],"predecessor-version":[{"id":556,"href":"https:\/\/chaoyu.nl\/index.php?rest_route=\/wp\/v2\/posts\/421\/revisions\/556"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chaoyu.nl\/index.php?rest_route=\/wp\/v2\/media\/424"}],"wp:attachment":[{"href":"https:\/\/chaoyu.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chaoyu.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chaoyu.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}