{"id":11899,"date":"2022-08-16T09:41:07","date_gmt":"2022-08-16T14:41:07","guid":{"rendered":"https:\/\/www.mrc-productivity.com\/docs\/?post_type=ht_kb&#038;p=11899"},"modified":"2023-11-08T16:00:51","modified_gmt":"2023-11-08T22:00:51","slug":"addinging-sso-via-oauth2-to-m-power-applications","status":"publish","type":"ht_kb","link":"https:\/\/www.mrc-productivity.com\/docs\/knowledge-base\/addinging-sso-via-oauth2-to-m-power-applications","title":{"rendered":"Adding SSO (via OAuth2) to m-Power Applications"},"content":{"rendered":"\n<p>This document will explain how to configure m-Power as well as a 3rd party tool (in our case, Microsoft&#8217;s Azure) to utilize OAuth2 for single sign on access to generated m-Power applications.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">This document assumes that your OAuth2 provider is Azure. However, you are free to connect with other providers as m-Power supports OAuth2 in general.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuring-m-power\">Configuring m-Power<\/h2>\n\n\n\n<p>Oauth2 SSO is configured at the data dictionary level. Therefore, you can control which dictionaries utilize this functionality and which do not. <\/p>\n\n\n\n<p>On your m-Power server, navigate to the mrc-runtime.properties file located in \/mrcjava\/WEB-INF\/classes and add the following lines to the file:<br><\/p>\n\n\n\n<p>oauth_ms_client_id=ENTER_IN_YOUR_CLIENT_ID_HERE<br>oauth_ms_client_secret=ENTER_IN_YOUR_SECRET_HERE<br>oauth_ms_discovery_url=https:\/\/login.microsoftonline.com\/YOUR_DIRECTORY_TENANT_ID_GOES_HERE\/v2.0\/.well-known\/openid-configuration<br>oauth_ms_callback_url=ENTER_IN_YOUR_CALL_BACK_URL_HERE<br>oauth_ms_scope=openid offline_access profile email https:\/\/graph.microsoft.com\/user.read<br>oauth_ms_response_type=code id_token<br>oauth_ms_response_mode=form_post<br>oauth_ms_grant_type=client_credentials<br>oauth_ms_name_key=preferred_username<\/p>\n\n\n\n<p>Your client ID is how your OAuth2 provider identifies your organization. The secret is essentially the password that helps to authenticate your request. Finally, the callback_url is the endpoint that the OAuth2 provider interacts with to essentially tell m-Power that the user is question is valid.<\/p>\n\n\n\n<p>How to obtain your Client ID, secret, and callback are discussed in further detail in the document below.<\/p>\n\n\n\n<p>After restarting Tomcat, log into m-Power and enable security <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"296\" height=\"353\" src=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-57.png\" alt=\"\" class=\"wp-image-11905\" srcset=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-57.png 296w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-57-252x300.png 252w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-57-126x150.png 126w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-57-42x50.png 42w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-57-50x60.png 50w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-57-84x100.png 84w\" sizes=\"(max-width: 296px) 100vw, 296px\" \/><\/figure>\n\n\n\n<p>(The default user\/password, if prompted, is mrcuser\/mrcuser)<\/p>\n\n\n\n<p>Next click the edit security settings option and change the Validation Type dropdown to &#8220;Validate by OAuth2&#8221;<\/p>\n\n\n\n<p>Change the &#8220;Data Source&#8221; option to &#8220;Other&#8221; and provide a value of &#8220;ms&#8221;<\/p>\n\n\n\n<p>Finally, when a user clicks Signoff of a runtime application, m-Power needs to redirect the user somewhere to tell them that their m-Power session has been terminated. You can specify a specific page by changing the &#8220;After Signoff Redirect&#8221; value to &#8220;\/mrcjava\/logout.html&#8221;<\/p>\n\n\n\n<p>You are welcome to customize this file as you see fit.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Promote to Production<\/h3>\n\n\n\n<p>To promote your security settings, please promote the mrcSignon2.xml file to production. To promote your log out file you&#8217;ve customized, promote the logout.html file to production. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuring-azure\">Configuring Azure<\/h2>\n\n\n\n<p>Log into your Azure portal at portal.azure.com. Open Azure Active Directory, then click App Registration<\/p>\n\n\n\n<p>Click &#8220;New Registration&#8221; Enter a name for your SSO Connection and click &#8220;Register&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"832\" height=\"408\" src=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-52.png\" alt=\"\" class=\"wp-image-11900\" srcset=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-52.png 832w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-52-300x147.png 300w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-52-150x74.png 150w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-52-768x377.png 768w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-52-50x25.png 50w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-52-60x29.png 60w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-52-100x49.png 100w\" sizes=\"(max-width: 832px) 100vw, 832px\" \/><\/figure>\n\n\n\n<p>Your screen should now look like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"900\" height=\"183\" src=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-53-900x183.png\" alt=\"\" class=\"wp-image-11901\" srcset=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-53-900x183.png 900w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-53-300x61.png 300w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-53-150x31.png 150w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-53-768x156.png 768w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-53-50x10.png 50w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-53-60x12.png 60w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-53-100x20.png 100w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-53.png 1448w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"obtain-a-secret-key\">Obtain a Secret Key<\/h3>\n\n\n\n<p>On the right hand side, click &#8220;Add a certificate or secret&#8221;<\/p>\n\n\n\n<p>Click &#8220;New client secret&#8221;<\/p>\n\n\n\n<p>Enter a description for this secret and select an expiration window.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">mrc suggests selecting the longest expiration window as once this secret expires you SSO will fail to work until a new valid secret is configured.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">It is advised that you create a reminder for yourself of when this secret will expire so you can be proactive and configure a new secret before this one expires.<\/p>\n\n\n\n<p>On the next screen, click the copy button next to the Secret Value (not the Secret ID). Save this secret value in a safe place as it will be needed later.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"900\" height=\"372\" src=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-54-900x372.png\" alt=\"\" class=\"wp-image-11902\" srcset=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-54-900x372.png 900w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-54-300x124.png 300w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-54-150x62.png 150w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-54-768x318.png 768w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-54-50x21.png 50w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-54-60x25.png 60w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-54-100x41.png 100w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-54.png 1312w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"obtain-tenant-id\">Obtain Tenant ID<\/h3>\n\n\n\n<p>Navigate back to the newly created app registration (Click the Overview button on the left side navigation panel).<\/p>\n\n\n\n<p>Make note of the Application (client) id as well as the Directory (tenant) id as both values will be needed later.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"configuring-redirect-uri\">Configuring Redirect URI<\/h3>\n\n\n\n<p>The Redirect URI is what tells your SSO provider (Azure in this case) what endpoint to connect to once a user has been validated. <\/p>\n\n\n\n<p>On the overview page, click the &#8220;Add a Redirect URI&#8221; link. Then click &#8220;Add a platform&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"900\" height=\"246\" src=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-55-900x246.png\" alt=\"\" class=\"wp-image-11903\" srcset=\"https:\/\/www.mrc-productivity.com\/docs\/images\/image-55-900x246.png 900w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-55-300x82.png 300w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-55-150x41.png 150w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-55-768x210.png 768w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-55-50x14.png 50w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-55-60x16.png 60w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-55-100x27.png 100w, https:\/\/www.mrc-productivity.com\/docs\/images\/image-55.png 1032w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/figure>\n\n\n\n<p>Click &#8220;Web&#8221;<\/p>\n\n\n\n<p>In the Redirect URI text input add the following text:<\/p>\n\n\n\n<p>https:\/\/yourserveraddress.com\/mrcjava\/servlet\/oauthcallback<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-alert\">Azure requires this resource to either be localhost or https. From a practicality standpoint, your site needs to have an SSL site for production functionality.<\/p>\n\n\n\n<p>Click both checkboxes at the end of the page (Access tokens and ID tokens). Then click configure<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This document will explain how to configure m-Power as well as a 3rd party tool (in our case, Microsoft&#8217;s Azure) to utilize OAuth2 for single sign on access to generated m-Power applications. Configuring m-Power Oauth2 SSO is configured at the data dictionary level. Therefore, you can control which dictionaries utilize&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[257],"ht-kb-tag":[297,296,295],"class_list":["post-11899","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-security","ht_kb_tag-security","ht_kb_tag-single-sign-on","ht_kb_tag-sso"],"_links":{"self":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/11899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/comments?post=11899"}],"version-history":[{"count":4,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/11899\/revisions"}],"predecessor-version":[{"id":13301,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb\/11899\/revisions\/13301"}],"wp:attachment":[{"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/media?parent=11899"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb-category?post=11899"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.mrc-productivity.com\/docs\/wp-json\/wp\/v2\/ht-kb-tag?post=11899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}