{"id":30820,"date":"2015-12-17T15:37:49","date_gmt":"2015-12-17T10:07:49","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=30820"},"modified":"2015-12-18T11:54:10","modified_gmt":"2015-12-18T06:24:10","slug":"cross-domain-sso-with-google-into-aws-console-using-saml","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/cross-domain-sso-with-google-into-aws-console-using-saml\/","title":{"rendered":"Cross-domain SSO with Google into AWS Console using SAML"},"content":{"rendered":"<p>Recently, I worked on a task wherein the users had to be authenticated based on existing Google credentials to get access of <a title=\"AWS Managed Services\" href=\"http:\/\/www.tothenew.com\/devops-aws\">AWS Management<\/a> Console. It took more time than expected to make it work as the documentation provided by Google is not complete. Let\u2019s start by setting this up step by step.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-30852\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/finl.png\" alt=\"finl\" width=\"642\" height=\"197\" \/><\/p>\n<h3><strong>Scenario:<\/strong><\/h3>\n<p>Provide access of AWS Management console to already existing Google users. Let\u2019s say the users belong to &#8220;singhnavjot.com&#8221; domain.<\/p>\n<p>We will use SAML 2.0 protocol to pass information of Google user to Amazon&#8217;s AWS. Here, Google is our SAML Authority or Identity Provider and Amazon\u2019s AWS is SAML consumer or Service Provider.<\/p>\n<p>Let&#8217;s configure it to provide access to a user whose email id is \u201cnavjot@singhnavjot.com\u201d.<\/p>\n<ol>\n<li>Login into the Google\u2019s admin console with the admin user. Once the below screen appears, click on \u201cApps\u201d:<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30838\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AdminConsole1.png\" alt=\"AdminConsole1\" width=\"548\" height=\"248\" \/><\/li>\n<li>Click on \u201cSAML apps\u201d:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30839\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/appstab.png\" alt=\"appstab\" width=\"556\" height=\"184\" \/><\/li>\n<li>Click on \u201cAdd a service\/App to your domain\u201d:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30821\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/1.png\" alt=\"1\" width=\"554\" height=\"188\" \/><\/li>\n<li>Select \u201cAmazon Web Services\u201d from the list and click next:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30822\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/2.png\" alt=\"2\" width=\"571\" height=\"542\" \/><\/li>\n<li>Download the &#8220;IDP metadata&#8221; file. We need to upload this file in AWS console while creating Identity provider. Click next:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30823\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/3.png\" alt=\"3\" width=\"572\" height=\"554\" \/><\/li>\n<li><strong>AWS Management console&#8217;s\u00a0settings<\/strong>: Login into AWS management console, go to IAM console and click \u201cIdentity Providers\u201d present on the left pane:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30840\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS1.png\" alt=\"AWS1\" width=\"573\" height=\"306\" \/><\/li>\n<li>Click on \u201cCreate Provider\u201d and choose provider type as \u201cSAML\u201d from the drop down list:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30841\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS2.png\" alt=\"AWS2\" width=\"578\" height=\"201\" \/><\/li>\n<li>Two fields will appear on the screen upon selecting \u201cSAML\u201d: \u201cProvider Name\u201d and \u201cMetadata Document\u201d:<br \/>\nProvide any name in the \u201cProvider Name\u201d field (say GoogleApp).<br \/>\nUpload the document downloaded in step 5 in the \u201cMetadata Document\u201d<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30842\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS3.png\" alt=\"AWS3\" width=\"572\" height=\"195\" \/><\/li>\n<li>Click \u201cNext Step\u201d present at the bottom right corner. Details verification page will appear. Save the \u201cProvider ARN\u201d as we will use it later. Save the Verify the information and click \u201cCreate\u201d present at the bottom right corner:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30843\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS4.png\" alt=\"AWS4\" width=\"569\" height=\"144\" \/><\/li>\n<li>We have created the Identity provider successfully. Now, we need to a define access permission for this Identity provider. This can be done creating \u201cRole\u201d in AWS.<\/li>\n<li>Go to \u201cRoles\u201d in IAM console and click \u201cCreate Role\u201d:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30844\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS5.png\" alt=\"AWS5\" width=\"575\" height=\"267\" \/><\/li>\n<li>Provide any name to the role (say GoogleAppRole) and click \u201cNext Step\u201d at the bottom right corner:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30845\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS6.png\" alt=\"AWS6\" width=\"577\" height=\"165\" \/><\/li>\n<li>Select \u201cRole for Identity Provider Access\u201d and then click \u201cSelect against \u201cGrant Web Single Sign-On (WebSSO) access to SAML providers\u201d:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30846\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS7.png\" alt=\"AWS7\" width=\"557\" height=\"177\" \/><\/li>\n<li>Select \u201cSAML Provider\u201d which we have created in step 9 from the drop-down list and click \u201cNext Step\u201d:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30847\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS8.png\" alt=\"AWS8\" width=\"576\" height=\"181\" \/><\/li>\n<li>\u201cPolicy Document\u201d will appear. Change it as per the requirement\u00a0otherwise, this would work for us. Click \u201cNext Step\u201d.<\/li>\n<li>Select the policy from the list. We are selecting \u201cReadOnlyAccess\u201d to provide our users who will use google credentials to login into AWS console a read-only access. Click \u201cNext Step\u201d to move to the verification page. Save the \u201cRole ARN\u201d as we will use it later.<\/li>\n<li>Click \u201cCreate Role\u201d at the bottom right corner.<br \/>\nWe have completed our AWS configuration.<\/li>\n<li>We will now move back to the Google Admin Console which we have left in step 5 where we have downloaded the IDP metadata. Click next.<\/li>\n<li>Provide any name to your SAML application (say AWS) and any description in the description box. A logo can be uploaded. It is optional. Click next:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30824\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/4.png\" alt=\"4\" width=\"575\" height=\"558\" \/><\/li>\n<li>Keep the ACS URL and Entity URL field intact. Keep the \u201cStart URL\u201d empty and \u201cSigned Response\u201d check box unchecked. In the \u201cName ID\u201d field, select \u201cBasic Information\u201d and \u201cPrimary email\u201d from the drop down list and click next:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30825\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/5.png\" alt=\"5\" width=\"571\" height=\"557\" \/><\/li>\n<li>In next step, we have two fields: \u201chttps:\/\/aws.amazon.com\/SAML\/Attributes\/RoleSessionName\u201d and \u201chttps:\/\/aws.amazon.com\/SAML\/Attributes\/Role\u201d. Choose anything against the fields present against them as we have to update it later. Click finish:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30827\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/6.png\" alt=\"6\" width=\"565\" height=\"543\" \/><\/li>\n<li>We have not told google about the role and Identity provider ARN that it will use. For this, we need to add a custom field using google SDK API and API explorer in the Google App which would take Role and Identity Provider ARN. Google App will use these details to communicate with AWS.<\/li>\n<li>We will add one user into the app and provide it the access to use the AWS console using the provided AWS role.<\/li>\n<li>First we need to get the customer id using directory.users.get API.<\/li>\n<li>Go to API explorer and click on the &#8220;directory.users.get&#8221; API in API explorer and fill your email id in the field \u201cuserKey\u201d as shown below. Keep the other fields empty and click authorize and execute. Make sure we have admin permission:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30828\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/7.png\" alt=\"7\" width=\"563\" height=\"296\" \/><\/li>\n<li>We will get 200 OK response with some information in the response. We can get \u201ccustomerId\u201d from the response.<\/li>\n<li>Now, go to API \u201cdirectory.schemas.insert and fill the customerId against the \u201ccustomerId\u201d field. Add the request body as shown below and hit execute and we will get 200 OK response. We have added a custom schema in our google app so that app can interpret the information that we will provide in the next step:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30829\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/8.png\" alt=\"8\" width=\"533\" height=\"252\" \/><br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30830\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/9.png\" alt=\"9\" width=\"580\" height=\"331\" \/><\/li>\n<li>Now, we are adding the AWS-related information in the fields using API directory.users.update.<\/li>\n<li>Go to the API and fill your email id again \u201cuserKey\u201d filed and role ARN and identity provider ARN as shown below and hit execute which should return 200 OK response. We are adding user and specifying Provider and Role ARNs which we have saved while working on AWS console. So, for every user, we can use either same or different Provider and Role ARN. The ARN specified below are comma separated:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-30831\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/10.png\" alt=\"10\" width=\"544\" height=\"173\" \/><\/li>\n<li>Now, we have added new custom schema and populated the fields. If we have only a few users then these steps can be repeated for all users.<\/li>\n<li>Now, go back to the google samSAMLl app and edit attribute mapping as follows and hit save: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-30849\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/AWS10.png\" alt=\"AWS10\" width=\"535\" height=\"104\" \/><\/li>\n<li>Now, we need to enable this app for users as follows:<\/li>\n<li>That&#8217;s all we need to do configure in the Google admin console.<\/li>\n<li>We can launch the app from the highlighted icons present at the top right side of the screen:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-30835\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/12\/14.png\" alt=\"14\" width=\"304\" height=\"126\" \/><\/li>\n<\/ol>\n<p>Upon launching the App we will be redirected to the AWS management console having ReadOnlyAccess. Similarly, different access permission can to granted to different users by assigning separate to the users.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I worked on a task wherein the users had to be authenticated based on existing Google credentials to get access of AWS Management Console. It took more time than expected to make it work as the documentation provided by Google is not complete. Let\u2019s start by setting this up step by step. Scenario: Provide [&hellip;]<\/p>\n","protected":false},"author":154,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":14},"categories":[1],"tags":[1221,2847,248,2902,2903,2897,2898,2899,2900,2895,2896,2904,1338,2901],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/30820"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/154"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=30820"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/30820\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=30820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=30820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=30820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}