{"id":682,"date":"2012-11-04T15:18:00","date_gmt":"2012-11-04T07:18:00","guid":{"rendered":"http:\/\/note.systw.net\/note\/?p=682"},"modified":"2023-11-04T15:29:46","modified_gmt":"2023-11-04T07:29:46","slug":"shibboleth-with-google","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/682","title":{"rendered":"shibboleth with google"},"content":{"rendered":"\n<p>shibboleth idp\u8207google app\u8a8d\u8b49\u6574\u5408<br>ps:shibboleth idp\u5efa\u7f6e\u8207\u8a2d\u5b9a\u53ef\u53c3\u8003<a href=\"https:\/\/systw.net\/note\/af\/sblog\/more.php?id=255\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/systw.net\/note\/af\/sblog\/more.php?id=255<\/a><\/p>\n\n\n\n<p><strong>shibboleth idp\u90e8\u4efd,\u6b65\u9a5f\u6458\u8981<\/strong><br>1\u5efa\u7acbgoogle app\u7684sp metadata<br>2\u900f\u904erelying-party.xml\u5c07\u8a72sp metadata\u7d0d\u5165idp<br>3\u900f\u904eattribute-resolver.xml\u65b0\u589eattribute\u9023\u63a5idp\u7684ldap<br>4\u900f\u904eattribute-policy.xml\u8a2d\u5b9a\u8a72attribute\u5b58\u53d6\u898f\u5247<\/p>\n\n\n\n<p>&#8230;..<\/p>\n\n\n\n<p><strong>1<br>\u5efa\u7acbsp metadata<\/strong><\/p>\n\n\n\n<p><strong>\u5728IDP_HOME\/metadata\u4e0b\u5efa\u7acbmetadata,\u4e26\u64c1\u6709\u4ee5\u4e0b\u8cc7\u6599<\/strong><br>&lt; md:EntityDescriptor entityID=&#8221;<strong>&lt; sp_entityid&gt;<\/strong>&#8221; validUntil=&#8221;2010-01-01T00:00:00Z&#8221;&gt;<br>&lt; md:SPSSODescriptor protocolSupportEnumeration=&#8221;<strong>&lt; value&gt;<\/strong>&#8221; &gt;<br>\u3000&lt; md:NameIDFormat&gt;&lt; \/md:NameIDFormat&gt;<br>\u3000&lt; md:AssertionConsumerService<br>Location=&#8221;<strong>&lt; relative path&gt;<\/strong>&#8221; index=&#8221;<strong>&lt; unsigned integer&gt;<\/strong>&#8221; Binding=&#8221;<strong>&lt; URI&gt;<\/strong>&#8220;<br>\/&gt;<br>&lt; \/md:SPSSODescriptor&gt;<br>&lt; \/md:EntityDescriptor&gt;<br><strong>\u8aaa\u660e\u5982\u4e0b<br>EntityDescriptor<\/strong><br>\u3000entityID=&#8221;&lt; sp_entityid&gt;&#8221; ,\u82e5\u6c92\u52fe\u9078Use a domain specific issuer,\u5247sp_entiyid\u70bagoogle.com<br>\u3000xmlns=&#8221;urn:oasis:names:tc:SAML:2.0:metadata&#8221;<br><strong>protocolSupportEnumeration<\/strong><br>\u652f\u63f4\u4ee5\u4e0b,\u82e5\u8a2d\u591a\u500b\u9700\u4ee5\u7a7a\u767d\u5206\u9694<br>\u3000urn:oasis:names:tc:SAML:1.1:protocol<br>\u3000urn:oasis:names:tc:SAML:2.0:protocol<br><strong>NameIDFormat(\u9078\u64c7\u6027)<\/strong><br>\u3000\u6307\u5b9asp saml name identifiers\u683c\u5f0f<br><strong>AssertionConsumerService(\u81f3\u5c11\u9700\u8a2d\u5b9a\u4e00\u500b)<\/strong><br>\u9700\u8a2d\u5b9alocation,binding,index<br>\u3000<strong>location<\/strong><br>\u3000\u9700\u8a2d\u5b9asp acs\u7684url\u4f4d\u7f6e<br>\u3000This is the location to which an IdP sends assertions using whatever protocol and binding it shares with the SP.<br>\u3000Each combination of SSO protocol and binding is usually installed at a unique location to improve efficiency.<br>\u3000<strong>binding<\/strong><br>\u3000\u652f\u63f4\u4ee5\u4e0buri<br>\u3000urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST<br>\u3000urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign<br>\u3000urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact<br>\u3000urn:oasis:names:tc:SAML:2.0:bindings:PAOS<br>\u3000<strong>index<\/strong><br>\u3000\u662f\u4e00\u500bacs endpoint\u7684tag,\u7528\u4f86\u53c3\u7167\u5230\u5176\u4ed6\u7d44\u614b\u5143\u7d20\u6216\u61c9\u7528,\u4e00\u822c\u90fd\u8a2d1<\/p>\n\n\n\n<p>ex<br>\u5047\u8a2d<br>sp_entityid=google.com<br>location=https:\/\/www.google.com\/a\/systw.net\/acs<br>\u5247<br>#vi $IDP_HOME\/metadata\/google-metadata.xml<br>&lt; EntityDescriptor entityID=&#8221;google.com&#8221; xmlns=&#8221;urn:oasis:names:tc:SAML:2.0:metadata&#8221;&gt;<br>\u3000&lt; SPSSODescriptor protocolSupportEnumeration=&#8221;urn:oasis:names:tc:SAML:2.0:protocol&#8221;&gt;<br>\u3000\u3000&lt; NameIDFormat&gt;urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified&lt; \/NameIDFormat&gt;<br>\u3000\u3000&lt; AssertionConsumerService<br>\u3000\u3000\u3000index=&#8221;1&#8243;<br>\u3000\u3000\u3000Binding=&#8221;urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&#8221;<br>\u3000\u3000\u3000Location=&#8221;https:\/\/www.google.com\/a\/systw.net\/acs&#8221; \/&gt;<br>\u3000&lt; \/SPSSODescriptor&gt;<br>&lt; \/EntityDescriptor&gt;<\/p>\n\n\n\n<p>&#8230;..<br>&nbsp;<br><strong>2<\/strong><br><strong>\u5b9a\u7fa9sp metadata\u4f86\u6e90<\/strong><br>\u7de8\u8f2f$IDP_HOME\/conf\/relying-party.xml,\u4e26\u8a2d\u5b9a\u4ee5\u4e0b<br>ex:<br>#vi $IDP_HOME\/conf\/relying-party.xml<br>ps:\u4ee5\u4e0bYOUR-ENTITY-ID\u53caIDP_HOME\u9700\u4f9d\u5be6\u969b\u74b0\u5883\u505a\u8a2d\u5b9a<\/p>\n\n\n\n<p><strong>2.1\u5b9a\u7fa9\u65b0\u7684RelyingParty element<\/strong><br>\u683c\u5f0f\u5982\u4e0b<br>&lt; RelyingParty id=&#8221;&lt; sp_entityid&gt;&#8221;<br>\u3000provider=&#8221;&lt; idp_entityid&gt;&#8221;<br>\u3000defaultSigningCredentialRef=&#8221;IdPCredential&#8221;&gt;<br>\u3000&lt; ProfileConfiguration xsi:type=&#8221;saml:SAML2SSOProfile&#8221; encryptAssertions=&#8221;never&#8221; encryptNameIds=&#8221;never&#8221; \/&gt;<br>&lt; \/RelyingParty&gt;<br><strong>\u8aaa\u660e\u5982\u4e0b<\/strong><br><strong>relying party<\/strong>\u3000\u4e3b\u8981\u6709\u4ee5\u4e0b3\u7a2e\u985e\u578b<br>\u3000&lt; AnonymousRelyingParty&gt;\u3000\u9700\u8a2d\u5b9aprovider\u5c6c\u6027<br>\u3000&lt; DefaultRelyingParty&gt; \u9700\u8a2d\u5b9aprovider\u5c6c\u6027<br>\u3000&lt; RelyingParty&gt;\u3000\u9700\u8a2d\u5b9aid\u53caprovider\u5c6c\u6027<br><strong>id<\/strong>&nbsp;\u8a2d\u5b9asp\u7684entityid<br><strong>provider<\/strong>\u3000\u8a2d\u5b9aidp\u7684entityid<br><strong>defaultSigningCredentialRef<\/strong>\u3000\u4f7f\u7528IdPCredential<br><strong>xsi:type<\/strong>\u3000\u4f7f\u7528saml:SAML2SSOProfile<br>ps:relying party\u76f8\u95dc\u8a2d\u5b9a\u8acb\u53c3\u8003https:\/\/spaces.internet2.edu\/display\/SHIB2\/IdPRelyingParty<br>ps:relying party\u76f8\u95dc\u8aaa\u660ehttps:\/\/spaces.internet2.edu\/display\/SHIB2\/IdPUnderstandingRP<br>ex:<br><strong>\u5c07\u4ee5\u4e0brelyingparty\u653e\u5165<\/strong><br>&lt; RelyingParty id=&#8221;google.com&#8221;<br>\u3000provider=&#8221;YOUR-ENTITY-ID&#8221;<br>\u3000defaultSigningCredentialRef=&#8221;IdPCredential&#8221;&gt;<br>\u3000&lt; ProfileConfiguration xsi:type=&#8221;saml:SAML2SSOProfile&#8221; encryptAssertions=&#8221;never&#8221; encryptNameIds=&#8221;never&#8221; \/&gt;<br>&lt; \/RelyingParty&gt;<\/p>\n\n\n\n<p><strong>2.2\u5c07\u525b\u624d\u5efa\u7acb\u7684sp metadata\u8a2d\u5b9a\u9032\u53bb<\/strong><br>\u683c\u5f0f\u5982\u4e0b<br>&lt; MetadataProvider id=&#8221;<strong>&lt; id&gt;<\/strong>&#8221; xsi:type=&#8221;FilesystemMetadataProvider&#8221; xmlns=&#8221;urn:mace:shibboleth:2.0:metadata&#8221;<br>metadataFile=&#8221;&lt; sp metadata path&gt;&#8221; maintainExpiredMetadata=&#8221;true&#8221; \/&gt;<br><strong>\u8aaa\u660e\u5982\u4e0b<\/strong><br><strong>id&nbsp;<\/strong>&nbsp; &nbsp;<br><strong>xsi:type<\/strong>\u4f7f\u7528&#8221;FilesystemMetadataProvider&#8221;<br><strong>xmlns<\/strong>\u4f7f\u7528&#8221;urn:mace:shibboleth:2.0:metadata<br><strong>metadataFile<\/strong>\u8981\u5b9a\u7fa9metadata file\u7684\u5be6\u969b\u4f4d\u7f6e<br>ps:<br>Define a New Metadata Source(\u5b9a\u7fa9\u65b0metadata\u4f86\u6e90\u8aaa\u660e)<br>https:\/\/spaces.internet2.edu\/display\/SHIB2\/IdPMetadataProvider<br>ex:<br><strong>\u5c07\u4ee5\u4e0bmetadataprovider\u653e\u5165&lt; metadata:MetadataProvider id=&#8221;ShibbolethMetadata&#8221; xsi:type=&#8221;metadata:ChainingMetadataProvider&#8221;&gt;\u548c&lt; \/metadata:MetadataProvider&gt;\u4e4b\u9593<\/strong><br>&lt; !&#8211; Google Metadata &#8211;&gt;<br>&lt; MetadataProvider id=&#8221;GoogleMD&#8221; xsi:type=&#8221;FilesystemMetadataProvider&#8221; xmlns=&#8221;urn:mace:shibboleth:2.0:metadata&#8221;<br>metadataFile=&#8221;IDP_HOME\/metadata\/google-metadata.xml&#8221; maintainExpiredMetadata=&#8221;true&#8221; \/&gt;<\/p>\n\n\n\n<p>&#8230;..<br><strong>3<\/strong><br><strong>\u65b0\u589eattribute\u9023\u63a5idp\u7684ldap<\/strong><br>&nbsp;<\/p>\n\n\n\n<p><strong>\u8a2d\u5b9aAttribute Definition\u548cAttribute Encoding<\/strong><br>#vi $IDP_HOME\/conf\/attribute-resolver.xml<br>&lt; resolver:AttributeDefinition id=&#8221;principal&#8221; xsi:type=&#8221;PrincipalName&#8221; xmlns=&#8221;urn:mace:shibboleth:2.0:resolver:ad&#8221;&gt;<br>\u3000&lt; resolver:Dependency ref=&#8221;myldap&#8221; \/&gt;<br>\u3000&lt; resolver:AttributeEncoder<br>\u3000\u3000xsi:type=&#8221;SAML2StringNameID&#8221;<br>\u3000\u3000xmlns=&#8221;urn:mace:shibboleth:2.0:attribute:encoder&#8221;<br>\u3000\u3000nameFormat=&#8221;urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified&#8221; \/&gt;<br>&lt; \/resolver:AttributeDefinition&gt;<br><strong>\u8aaa\u660e\u5982\u4e0b<\/strong><br><strong>AttributeDefinition\u90e8\u4efd<\/strong><br>\u3000<strong>id<\/strong>&nbsp;\u7528\u65bc\u548cAttributeRule attributeID\u5c0d\u61c9\u7684\u7de8\u865f<br>\u3000<strong>xsi:type<\/strong>\u4f7f\u7528principal name attribute definition &nbsp;<br>\u3000<strong>resolver:Dependency ref<\/strong>&nbsp;\u7528\u65bc\u548cdataconnector\u5c0d\u61c9\u7684\u7de8\u865f<br><strong>AttributeEncoder\u90e8\u4efd<\/strong><br>\u3000<strong>xsi:type<\/strong>\u4f7f\u7528&#8221;SAML2StringNameID&#8221;<\/p>\n\n\n\n<p>ex:<br><strong>\u65b0\u589eprincipal\u5c6c\u6027,\u4e26\u7528myldap\u9023\u63a5idp<\/strong><br>#vi $IDP_HOME\/conf\/attribute-resolver.xml<br>&lt; resolver:AttributeDefinition id=&#8221;principal&#8221; xsi:type=&#8221;PrincipalName&#8221; xmlns=&#8221;urn:mace:shibboleth:2.0:resolver:ad&#8221;&gt;<br>\u3000&lt; resolver:Dependency ref=&#8221;myldap&#8221; \/&gt;<br>\u3000&lt; resolver:AttributeEncoder<br>\u3000\u3000xsi:type=&#8221;SAML2StringNameID&#8221;<br>\u3000\u3000xmlns=&#8221;urn:mace:shibboleth:2.0:attribute:encoder&#8221;<br>\u3000\u3000nameFormat=&#8221;urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified&#8221; \/&gt;<br>&lt; \/resolver:AttributeDefinition&gt;<\/p>\n\n\n\n<p>ps:<br>release the attribute<br>\u4fee\u6539attribute-filter.xml\u4ee5\u8a2d\u5b9aattribute filter policy,\u624d\u53ef\u4f7f\u7528\u65b0\u7684attribute,\u5982\u4e0b\u6b65\u9a5f4<\/p>\n\n\n\n<p>&#8230;..<br><strong>4<\/strong><br><strong>\u8a2d\u5b9aattribute\u5b58\u53d6\u898f\u5247<\/strong><br><\/p>\n\n\n\n<p><strong>\u900f\u904epolicy\u8a2d\u5b9aattribute\u7684\u5b58\u53d6\u898f\u5247<\/strong><br>#vi IDP_HOME\/conf\/attribute-filter.xml<br>&lt; afp:AttributeFilterPolicy id=&#8221;unique name&#8221;&gt;<br>\u3000&lt; afp:PolicyRequirementRule xsi:type=&#8221;&lt; type&gt;&#8221; \/&gt;<br>\u3000&lt; afp:AttributeRule attributeID=&#8221;&lt; attributeid&gt;&#8221;&gt;<br>\u3000\u3000&lt; afp:PermitValueRule xsi:type=&#8221;&lt; type&gt;&#8221; \/&gt;<br>\u3000&lt; \/afp:AttributeRule&gt;<br>&lt; \/afp:AttributeFilterPolicy&gt;<br>\u8aaa\u660e\u5982\u4e0b<br><strong>AttributeFilterPolicy id<\/strong>&nbsp;\u81ea\u884c\u8a2d\u5b9a\u4e00\u500b\u4e0d\u8981\u91cd\u8986\u7684\u552f\u4e00\u540d\u7a31&nbsp;<br><strong>AttributeRule attributeID<\/strong>&nbsp;\u7528\u65bc\u548cAttributeDefinition id\u5c0d\u61c9\u7684\u7de8\u865f<\/p>\n\n\n\n<p>ex:<br><strong>\u8a2d\u5b9aprincipal\u5c6c\u6027\u4f7f\u7528\u7684policy<\/strong><br>&lt; afp:AttributeFilterPolicy id=&#8221;releasetoanyone&#8221;&gt;<br>\u3000&lt; afp:PolicyRequirementRule xsi:type=&#8221;basic:AttributeRequesterString&#8221; value=&#8221;google.com&#8221; \/&gt;<br>\u3000&lt; afp:AttributeRule attributeID=&#8221;principal&#8221;&gt;<br>\u3000\u3000&lt; afp:PermitValueRule xsi:type=&#8221;basic:ANY&#8221; \/&gt;<br>\u3000&lt; \/afp:AttributeRule&gt;<br>&lt; \/afp:AttributeFilterPolicy&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>shibboleth idp\u8207google app\u8a8d\u8b49\u6574\u5408p &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[21],"tags":[],"class_list":["post-682","post","type-post","status-publish","format-standard","hentry","category-linuxservice"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/682","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=682"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/682\/revisions"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=682"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=682"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=682"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}