{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":42468,"path":"platform-user-interface/service-portal/configure-widget-security.md","title":"Configure widget security","bundle":null,"doc_type":null,"release":"australia","body":"\n# Configure widget security\n\nConfigure widget security to ensure that your widget is being accessed only by the intended audience.\n\n## Before you begin\n\nRole required: admin or sp\\_admin\n\n## About this task\n\nThere are several ways to configure widget security:\n\n-   Restrict the widget to users with a login only \\(authenticated users\\)\n-   Restrict the widget to users with certain roles only\n-   Restrict which tables a public widget can access and return data from for guest \\(unauthenticated\\) users\n\nWhen you configure widget security, configure the page security accordingly so that users can access the widget via the page on which it appears. For more information, see [Configure page security by role](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-user-interface/service-portal/configure-page-security.md).\n\n## Procedure\n\n1.  Navigate to **All** &gt; **Service Portal** &gt; **Widgets**.\n\n2.  Open the record of the widget to configure.\n\n3.  On the form, configure the widget security.\n\n<table id=\"choicetable_n5r_xyt_hkb\"><thead><tr><th align=\"left\" id=\"d37488e103\">\n\nOption\n\n</th><th align=\"left\" id=\"d37488e106\">\n\nProcedure\n\n</th></tr></thead><tbody><tr><td id=\"d37488e112\">\n\n**Restrict the widget to authenticated users**\n\n</td><td>\n\nClear the **Public** check box and leave the **Roles** field blank.\n\n</td></tr><tr><td id=\"d37488e127\">\n\n**Restrict the widget to certain roles**\n\n</td><td>\n\n1.  Clear the **Public** check box.\n2.  Next to **Roles**, select the edit icon \\(\\[Omitted image \"edit-icon.png\"\\] Alt text: Edit icon\\).\n3.  On the Roles window, select a role by moving it from the **Available** list to the **Selected** list.\n4.  Select **Done**.\n\n\n</td></tr><tr><td id=\"d37488e172\">\n\n**Restrict which tables public widgets can access for guest users**\n\n</td><td>\n\n1.  Select the **Public** check box.\n\n**Note:** Public widgets are accessible by any user even if the **Roles** list contains roles.\n\n2.  Specify the tables that public widgets can access for guest users.\n\nThis applies to widgets that accept the table input parameter only.\n\n    1.  In the **Public Table Allow List** related list, select **New**.\n    2.  In the **Tables** field, select a table from which guest users can access data in the widget.\n    3.  Select **Submit**.\n    4.  Repeat these steps to add additional tables.\n3.  In the **Server script** field, call the SPWidgetAccessControl API before any call to GlideRecord\\(options.table\\) and GlideRecordSecure\\(options.table\\). For example:\n\n    ```javascript\nif(!new global.SPWidgetAccessControl().hasPublicAccess(options.table, $sp, options, input)){\n\t\tgs.warn(\"Deny access to table which is not public: \" + options.table);\n\t\tdata.isValid = false;\n\t\treturn;\n\t}\n    ```\n\nThe parameters passed with SPWidgetAccessControl should be the same as those passed with GlideRecord\\(options.table\\) and GlideRecordSecure\\(options.table\\). For details on the SPWidgetAccessControl API, see .\n\n4.  Select **Save**.\n\n\n</td></tr></tbody>\n</table>4.  Select **Update**.\n\n\n**Parent Topic:**[Managing portal access](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-user-interface/service-portal/portal-security.md)\n\n"}}