{"action":"created","comment":{"url":"https://api.github.com/repos/Jasig/cas/pulls/comments/34443612","id":34443612,"diff_hunk":"@@ -0,0 +1,175 @@\n+/*\n+ * Licensed to Apereo under one or more contributor license\n+ * agreements. See the NOTICE file distributed with this work\n+ * for additional information regarding copyright ownership.\n+ * Apereo licenses this file to you under the Apache License,\n+ * Version 2.0 (the \"License\"); you may not use this file\n+ * except in compliance with the License.  You may obtain a\n+ * copy of the License at the following location:\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+\n+package org.jasig.cas.support.saml.web.flow.mdui;\n+\n+import org.apache.commons.lang3.StringUtils;\n+import org.jasig.cas.authentication.principal.SimpleWebApplicationServiceImpl;\n+import org.jasig.cas.authentication.principal.WebApplicationService;\n+import org.jasig.cas.services.RegisteredService;\n+import org.jasig.cas.services.ServicesManager;\n+import org.jasig.cas.services.UnauthorizedServiceException;\n+import org.jasig.cas.web.support.WebUtils;\n+import org.opensaml.core.xml.XMLObject;\n+import org.opensaml.saml.common.xml.SAMLConstants;\n+import org.opensaml.saml.ext.saml2mdui.UIInfo;\n+import org.opensaml.saml.saml2.metadata.EntityDescriptor;\n+import org.opensaml.saml.saml2.metadata.Extensions;\n+import org.opensaml.saml.saml2.metadata.SPSSODescriptor;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.webflow.action.AbstractAction;\n+import org.springframework.webflow.execution.Event;\n+import org.springframework.webflow.execution.RequestContext;\n+\n+import javax.servlet.http.HttpServletRequest;\n+import javax.validation.constraints.NotNull;\n+import java.util.List;\n+\n+/**\n+ * This is {@link SamlMetadataUIParserAction} that attempts to parse\n+ * the mdui extension block for a SAML SP from the provided metadata locations.\n+ * The result is put into the flow request context under the parameter\n+ * {@link #MDUI_FLOW_PARAMETER_NAME}. The entity id parameter is\n+ * specified by default at {@link #ENTITY_ID_PARAMETER_NAME}.\n+ *\n+ * <p>This action is best suited to be invoked when the CAS login page\n+ * is about to render so that the page, once the MDUI info is obtained,\n+ * has a chance to populate the UI with relevant info about the SP.</p>\n+ *\n+ * @author Misagh Moayyed\n+ * @since 4.1.0\n+ */\n+public class SamlMetadataUIParserAction extends AbstractAction {","path":"cas-server-support-saml/src/main/java/org/jasig/cas/support/saml/web/flow/mdui/SamlMetadataUIParserAction.java","position":60,"original_position":60,"commit_id":"cb42fc06d3cd87d25376caeb703aedecd56279f4","original_commit_id":"cb42fc06d3cd87d25376caeb703aedecd56279f4","user":{"login":"leleuj","id":1038508,"avatar_url":"https://avatars.githubusercontent.com/u/1038508?v=3","gravatar_id":"","url":"https://api.github.com/users/leleuj","html_url":"https://github.com/leleuj","followers_url":"https://api.github.com/users/leleuj/followers","following_url":"https://api.github.com/users/leleuj/following{/other_user}","gists_url":"https://api.github.com/users/leleuj/gists{/gist_id}","starred_url":"https://api.github.com/users/leleuj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leleuj/subscriptions","organizations_url":"https://api.github.com/users/leleuj/orgs","repos_url":"https://api.github.com/users/leleuj/repos","events_url":"https://api.github.com/users/leleuj/events{/privacy}","received_events_url":"https://api.github.com/users/leleuj/received_events","type":"User","site_admin":false},"body":"I'm not very comfortable with the concept here, but I'm surprised to see this extraction happens in an `Action`: wouldn't it be better in some `ArgumentExtractor`?","created_at":"2015-07-13T08:51:06Z","updated_at":"2015-07-13T08:51:06Z","html_url":"https://github.com/Jasig/cas/pull/993#discussion_r34443612","pull_request_url":"https://api.github.com/repos/Jasig/cas/pulls/993","_links":{"self":{"href":"https://api.github.com/repos/Jasig/cas/pulls/comments/34443612"},"html":{"href":"https://github.com/Jasig/cas/pull/993#discussion_r34443612"},"pull_request":{"href":"https://api.github.com/repos/Jasig/cas/pulls/993"}}},"pull_request":{"url":"https://api.github.com/repos/Jasig/cas/pulls/993","id":37516346,"html_url":"https://github.com/Jasig/cas/pull/993","diff_url":"https://github.com/Jasig/cas/pull/993.diff","patch_url":"https://github.com/Jasig/cas/pull/993.patch","issue_url":"https://api.github.com/repos/Jasig/cas/issues/993","number":993,"state":"open","locked":false,"title":"Allow CAS to parse/display SAML MDUI","user":{"login":"mmoayyed","id":1205228,"avatar_url":"https://avatars.githubusercontent.com/u/1205228?v=3","gravatar_id":"","url":"https://api.github.com/users/mmoayyed","html_url":"https://github.com/mmoayyed","followers_url":"https://api.github.com/users/mmoayyed/followers","following_url":"https://api.github.com/users/mmoayyed/following{/other_user}","gists_url":"https://api.github.com/users/mmoayyed/gists{/gist_id}","starred_url":"https://api.github.com/users/mmoayyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmoayyed/subscriptions","organizations_url":"https://api.github.com/users/mmoayyed/orgs","repos_url":"https://api.github.com/users/mmoayyed/repos","events_url":"https://api.github.com/users/mmoayyed/events{/privacy}","received_events_url":"https://api.github.com/users/mmoayyed/received_events","type":"User","site_admin":false},"body":"This is a webflow action that allows CAS to read the MDUI info from SAML metadata sources. \r\n\r\nExample follows:\r\n\r\n```xml\r\n    <bean id=\"samlMetadataUIParserAction\" class=\"org.jasig.cas.support.saml.web.flow.SamlMetadataUIParserAction\"\r\n          c:entityIdParameterName=\"entityId\"\r\n          c:metadataResources-ref=\"metadataResources\"\r\n          lazy-init=\"true\"  />\r\n\r\n    <util:list id=\"metadataResources\">\r\n        <value>http://md.incommon.org/InCommon/InCommon-metadata.xml</value>\r\n    </util:list>\r\n```\r\n\r\nBy default, in CAS/Shibboleth integrations specially the SP entityId is passed to CAS via an entityId parameter, which this action will read and attempts to locate the MDUI info next. Missing MDUI info can be overridden by the CAS Service Registry. \r\n\r\nScreenshot:\r\n\r\n![capture](https://cloud.githubusercontent.com/assets/1205228/8120071/095c7628-1050-11e5-810e-7bce128391df.PNG)\r\n","created_at":"2015-06-11T22:38:51Z","updated_at":"2015-07-13T08:51:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3efee0e07cfcae5797d79108d9ecbe570470bf6","assignee":null,"milestone":{"url":"https://api.github.com/repos/Jasig/cas/milestones/2","html_url":"https://github.com/Jasig/cas/milestones/4.1.0","labels_url":"https://api.github.com/repos/Jasig/cas/milestones/2/labels","id":721279,"number":2,"title":"4.1.0","description":"CAS 4.1.0 Release","creator":{"login":"mmoayyed","id":1205228,"avatar_url":"https://avatars.githubusercontent.com/u/1205228?v=3","gravatar_id":"","url":"https://api.github.com/users/mmoayyed","html_url":"https://github.com/mmoayyed","followers_url":"https://api.github.com/users/mmoayyed/followers","following_url":"https://api.github.com/users/mmoayyed/following{/other_user}","gists_url":"https://api.github.com/users/mmoayyed/gists{/gist_id}","starred_url":"https://api.github.com/users/mmoayyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmoayyed/subscriptions","organizations_url":"https://api.github.com/users/mmoayyed/orgs","repos_url":"https://api.github.com/users/mmoayyed/repos","events_url":"https://api.github.com/users/mmoayyed/events{/privacy}","received_events_url":"https://api.github.com/users/mmoayyed/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":351,"state":"open","created_at":"2014-07-15T06:16:10Z","updated_at":"2015-07-11T19:46:42Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/Jasig/cas/pulls/993/commits","review_comments_url":"https://api.github.com/repos/Jasig/cas/pulls/993/comments","review_comment_url":"https://api.github.com/repos/Jasig/cas/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Jasig/cas/issues/993/comments","statuses_url":"https://api.github.com/repos/Jasig/cas/statuses/cb42fc06d3cd87d25376caeb703aedecd56279f4","head":{"label":"Unicon:mdui-entityid-login","ref":"mdui-entityid-login","sha":"cb42fc06d3cd87d25376caeb703aedecd56279f4","user":{"login":"Unicon","id":835400,"avatar_url":"https://avatars.githubusercontent.com/u/835400?v=3","gravatar_id":"","url":"https://api.github.com/users/Unicon","html_url":"https://github.com/Unicon","followers_url":"https://api.github.com/users/Unicon/followers","following_url":"https://api.github.com/users/Unicon/following{/other_user}","gists_url":"https://api.github.com/users/Unicon/gists{/gist_id}","starred_url":"https://api.github.com/users/Unicon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unicon/subscriptions","organizations_url":"https://api.github.com/users/Unicon/orgs","repos_url":"https://api.github.com/users/Unicon/repos","events_url":"https://api.github.com/users/Unicon/events{/privacy}","received_events_url":"https://api.github.com/users/Unicon/received_events","type":"Organization","site_admin":false},"repo":{"id":6410069,"name":"cas","full_name":"Unicon/cas","owner":{"login":"Unicon","id":835400,"avatar_url":"https://avatars.githubusercontent.com/u/835400?v=3","gravatar_id":"","url":"https://api.github.com/users/Unicon","html_url":"https://github.com/Unicon","followers_url":"https://api.github.com/users/Unicon/followers","following_url":"https://api.github.com/users/Unicon/following{/other_user}","gists_url":"https://api.github.com/users/Unicon/gists{/gist_id}","starred_url":"https://api.github.com/users/Unicon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Unicon/subscriptions","organizations_url":"https://api.github.com/users/Unicon/orgs","repos_url":"https://api.github.com/users/Unicon/repos","events_url":"https://api.github.com/users/Unicon/events{/privacy}","received_events_url":"https://api.github.com/users/Unicon/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Unicon/cas","description":"Jasig CAS - Single Sign On for the Web","fork":true,"url":"https://api.github.com/repos/Unicon/cas","forks_url":"https://api.github.com/repos/Unicon/cas/forks","keys_url":"https://api.github.com/repos/Unicon/cas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Unicon/cas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Unicon/cas/teams","hooks_url":"https://api.github.com/repos/Unicon/cas/hooks","issue_events_url":"https://api.github.com/repos/Unicon/cas/issues/events{/number}","events_url":"https://api.github.com/repos/Unicon/cas/events","assignees_url":"https://api.github.com/repos/Unicon/cas/assignees{/user}","branches_url":"https://api.github.com/repos/Unicon/cas/branches{/branch}","tags_url":"https://api.github.com/repos/Unicon/cas/tags","blobs_url":"https://api.github.com/repos/Unicon/cas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Unicon/cas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Unicon/cas/git/refs{/sha}","trees_url":"https://api.github.com/repos/Unicon/cas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Unicon/cas/statuses/{sha}","languages_url":"https://api.github.com/repos/Unicon/cas/languages","stargazers_url":"https://api.github.com/repos/Unicon/cas/stargazers","contributors_url":"https://api.github.com/repos/Unicon/cas/contributors","subscribers_url":"https://api.github.com/repos/Unicon/cas/subscribers","subscription_url":"https://api.github.com/repos/Unicon/cas/subscription","commits_url":"https://api.github.com/repos/Unicon/cas/commits{/sha}","git_commits_url":"https://api.github.com/repos/Unicon/cas/git/commits{/sha}","comments_url":"https://api.github.com/repos/Unicon/cas/comments{/number}","issue_comment_url":"https://api.github.com/repos/Unicon/cas/issues/comments{/number}","contents_url":"https://api.github.com/repos/Unicon/cas/contents/{+path}","compare_url":"https://api.github.com/repos/Unicon/cas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Unicon/cas/merges","archive_url":"https://api.github.com/repos/Unicon/cas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Unicon/cas/downloads","issues_url":"https://api.github.com/repos/Unicon/cas/issues{/number}","pulls_url":"https://api.github.com/repos/Unicon/cas/pulls{/number}","milestones_url":"https://api.github.com/repos/Unicon/cas/milestones{/number}","notifications_url":"https://api.github.com/repos/Unicon/cas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Unicon/cas/labels{/name}","releases_url":"https://api.github.com/repos/Unicon/cas/releases{/id}","created_at":"2012-10-26T20:34:46Z","updated_at":"2015-06-10T18:22:29Z","pushed_at":"2015-07-11T22:58:07Z","git_url":"git://github.com/Unicon/cas.git","ssh_url":"git@github.com:Unicon/cas.git","clone_url":"https://github.com/Unicon/cas.git","svn_url":"https://github.com/Unicon/cas","homepage":"http://www.jasig.org/cas","size":46927,"stargazers_count":23,"watchers_count":23,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"open_issues_count":0,"forks":23,"open_issues":0,"watchers":23,"default_branch":"master"}},"base":{"label":"Jasig:master","ref":"master","sha":"533091f34caccd5ad4bfff22e83a12cd2cd360b2","user":{"login":"Jasig","id":884285,"avatar_url":"https://avatars.githubusercontent.com/u/884285?v=3","gravatar_id":"","url":"https://api.github.com/users/Jasig","html_url":"https://github.com/Jasig","followers_url":"https://api.github.com/users/Jasig/followers","following_url":"https://api.github.com/users/Jasig/following{/other_user}","gists_url":"https://api.github.com/users/Jasig/gists{/gist_id}","starred_url":"https://api.github.com/users/Jasig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jasig/subscriptions","organizations_url":"https://api.github.com/users/Jasig/orgs","repos_url":"https://api.github.com/users/Jasig/repos","events_url":"https://api.github.com/users/Jasig/events{/privacy}","received_events_url":"https://api.github.com/users/Jasig/received_events","type":"Organization","site_admin":false},"repo":{"id":2352744,"name":"cas","full_name":"Jasig/cas","owner":{"login":"Jasig","id":884285,"avatar_url":"https://avatars.githubusercontent.com/u/884285?v=3","gravatar_id":"","url":"https://api.github.com/users/Jasig","html_url":"https://github.com/Jasig","followers_url":"https://api.github.com/users/Jasig/followers","following_url":"https://api.github.com/users/Jasig/following{/other_user}","gists_url":"https://api.github.com/users/Jasig/gists{/gist_id}","starred_url":"https://api.github.com/users/Jasig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jasig/subscriptions","organizations_url":"https://api.github.com/users/Jasig/orgs","repos_url":"https://api.github.com/users/Jasig/repos","events_url":"https://api.github.com/users/Jasig/events{/privacy}","received_events_url":"https://api.github.com/users/Jasig/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Jasig/cas","description":"Apereo CAS - Single Sign On for the Web","fork":false,"url":"https://api.github.com/repos/Jasig/cas","forks_url":"https://api.github.com/repos/Jasig/cas/forks","keys_url":"https://api.github.com/repos/Jasig/cas/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Jasig/cas/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Jasig/cas/teams","hooks_url":"https://api.github.com/repos/Jasig/cas/hooks","issue_events_url":"https://api.github.com/repos/Jasig/cas/issues/events{/number}","events_url":"https://api.github.com/repos/Jasig/cas/events","assignees_url":"https://api.github.com/repos/Jasig/cas/assignees{/user}","branches_url":"https://api.github.com/repos/Jasig/cas/branches{/branch}","tags_url":"https://api.github.com/repos/Jasig/cas/tags","blobs_url":"https://api.github.com/repos/Jasig/cas/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Jasig/cas/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Jasig/cas/git/refs{/sha}","trees_url":"https://api.github.com/repos/Jasig/cas/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Jasig/cas/statuses/{sha}","languages_url":"https://api.github.com/repos/Jasig/cas/languages","stargazers_url":"https://api.github.com/repos/Jasig/cas/stargazers","contributors_url":"https://api.github.com/repos/Jasig/cas/contributors","subscribers_url":"https://api.github.com/repos/Jasig/cas/subscribers","subscription_url":"https://api.github.com/repos/Jasig/cas/subscription","commits_url":"https://api.github.com/repos/Jasig/cas/commits{/sha}","git_commits_url":"https://api.github.com/repos/Jasig/cas/git/commits{/sha}","comments_url":"https://api.github.com/repos/Jasig/cas/comments{/number}","issue_comment_url":"https://api.github.com/repos/Jasig/cas/issues/comments{/number}","contents_url":"https://api.github.com/repos/Jasig/cas/contents/{+path}","compare_url":"https://api.github.com/repos/Jasig/cas/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Jasig/cas/merges","archive_url":"https://api.github.com/repos/Jasig/cas/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Jasig/cas/downloads","issues_url":"https://api.github.com/repos/Jasig/cas/issues{/number}","pulls_url":"https://api.github.com/repos/Jasig/cas/pulls{/number}","milestones_url":"https://api.github.com/repos/Jasig/cas/milestones{/number}","notifications_url":"https://api.github.com/repos/Jasig/cas/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Jasig/cas/labels{/name}","releases_url":"https://api.github.com/repos/Jasig/cas/releases{/id}","created_at":"2011-09-09T01:36:42Z","updated_at":"2015-07-13T03:23:14Z","pushed_at":"2015-07-11T19:46:42Z","git_url":"git://github.com/Jasig/cas.git","ssh_url":"git@github.com:Jasig/cas.git","clone_url":"https://github.com/Jasig/cas.git","svn_url":"https://github.com/Jasig/cas","homepage":"https://www.apereo.org/cas","size":508581,"stargazers_count":758,"watchers_count":758,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":572,"mirror_url":null,"open_issues_count":65,"forks":572,"open_issues":65,"watchers":758,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Jasig/cas/pulls/993"},"html":{"href":"https://github.com/Jasig/cas/pull/993"},"issue":{"href":"https://api.github.com/repos/Jasig/cas/issues/993"},"comments":{"href":"https://api.github.com/repos/Jasig/cas/issues/993/comments"},"review_comments":{"href":"https://api.github.com/repos/Jasig/cas/pulls/993/comments"},"review_comment":{"href":"https://api.github.com/repos/Jasig/cas/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Jasig/cas/pulls/993/commits"},"statuses":{"href":"https://api.github.com/repos/Jasig/cas/statuses/cb42fc06d3cd87d25376caeb703aedecd56279f4"}}}}