<div dir="ltr">Hello @Andrew Morgan, Thanks a lot for your support.Definitely i will ask questions to get clarification.<div>Once an authentication is done, i will get the necessary attributes from SAMLResponse through attribute-resolver,attribute-filter.xml. So i can get my necessary user permissions by querying our database through Data Connector.</div><div><br></div><div>But my doubt is how could i get the Principal(includes email, acctype) without querying  database, I think this is because of that we are sending </div><div>req.setAttribute(LoginHandler.Principal_Key, login.getAttributes()); to</div><div>AuthenticationEngine.returnToAuthenticationengine(req,resp);</div><div><br></div><div>By sending the  login.getAttributes() as principal to the AuthenticationEngine, we are able to get those in response by giving defining the &#39;xsi:type=&quot;PrincipalName&#39; id=&quot;principal&quot; in the attribute-resolver.xml.</div><div><br></div><div>am i correct? Please let me know if i am wrong?</div><div><br></div><div>Sorry for asking this question, because i am new to my existing project, this one is implemented by some other person(he is not here now).     </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 5, 2014 at 12:01 AM, Andrew Morgan <span dir="ltr">&lt;<a href="mailto:morgan@orst.edu" target="_blank">morgan@orst.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, 4 Dec 2014, Surinaidu Majji wrote:<br>
<br>
&gt; Thank you very much @Andy for your reply after looking into my query deeply.<br>
&gt; I got better understanding about shibboleth flow when i saw your reply.<br>
&gt;<br>
&gt; The Shibboleth IDP performs authentication via a variety of methods.<br>
&gt; -&gt;Here i am using &#39;ExternalAuth&#39; in which it goes to the my custom Url to<br>
&gt; make further processing.<br>
&gt;<br>
&gt; If you want to change the login.jsp script to<br>
&gt; validate credentials against a different database, you can do that.<br>
&gt; -&gt; Yes I can do that and here i am thinking that only to deal with one<br>
&gt; login.jsp for both the databases, any way that depends on my design.<br>
&gt;<br>
&gt; After authentication is successful, the Shibboleth IDP will attempt to<br>
&gt; resolve attributes (find more information about) the principal returned by<br>
&gt; the authentication step<br>
&gt; - since i am using &#39;ExternalAuth&#39;, and i am not  using any &#39;UserName&#39;<br>
&gt; particularly<br>
&gt; i am writing the code which is according to the shibboleth website for<br>
&gt; externalAuth(use subject to get control over principal)<br>
&gt;<br>
&gt; This code is written after authentication is successful against my database.<br>
&gt; request.setAttribute(globalStrings.getForceAuthn(), false);<br>
&gt; Principal principal = new UsernamePrincipal(login.getAttributes());<br>
&gt; Subject subj = new Subject();<br>
&gt; subj.getPrincipals().add(principal);<br>
&gt; request.setAttribute(LoginHandler.PRINCIPAL_KEY, principal);<br>
&gt; request.setAttribute(LoginHandler.PRINCIPAL_NAME_KEY, personId);<br>
&gt; request.setAttribute(LoginHandler.SUBJECT_KEY, subj);<br>
&gt; request.setAttribute(globalStrings.getAuthnMethod(),<br>
&gt; this.authenticationMethod);<br>
&gt; AuthenticationEngine.returnToAuthenticationEngine(request, response);<br>
<br>
</div></div>It is my understanding that the attributes released by the IDP *only* come<br>
from the attribute resolution step.  I don&#39;t think attributes can be added<br>
by the external auth handler.  It should be using the &quot;principal&quot; as the<br>
key to lookup additional attributes in your Data Connector.<br>
<div><div class="h5"><br>
&gt; The attribute resolution is configured in attribute-resolver.xml.<br>
&gt; - The below is my attribute-resolver.xml to resolve the attributes, please<br>
&gt; look into it.<br>
&gt;<br>
&gt; &lt;resolver:AttributeDefinition id=&quot;principal&quot; xsi:type=&quot;PrincipalName&quot;<br>
&gt; xmlns=&quot;urn:mace:shibboleth:2.0:resolver:ad&quot;&gt;<br>
&gt;<br>
&gt;   &lt;resolver:AttributeEncoder xsi:type=&quot;enc:SAML2StringNameID&quot; /&gt;<br>
&gt;<br>
&gt; &lt;resolver:AttributeEncoder xsi:type=&quot;SAML2Base64&quot;<br>
&gt; xmlns=&quot;urn:mace:shibboleth:2.0:attribute:encoder&quot;<br>
&gt;                                name=&quot;ORG_ATTRIBUTE_64&quot; /&gt;<br>
&gt;  &lt;resolver:AttributeEncoder xsi:type=&quot;SAML2String&quot;<br>
&gt; xmlns=&quot;urn:mace:shibboleth:2.0:attribute:encoder&quot;<br>
&gt;                                name=&quot;ORG_ATTRIBUTE&quot; /&gt;<br>
&gt; for the above, there is no &quot;dataconnector&quot; is used.<br>
&gt;<br>
&gt; attribute-filter.xml:<br>
&gt;<br>
&gt; &lt;afp:AttributeFilterPolicy id=&quot;releaseBasicAttributesToAnyone&quot;&gt;<br>
&gt;        &lt;afp:PolicyRequirementRule xsi:type=&quot;basic:ANY&quot;/&gt;<br>
&gt;        &lt;afp:AttributeRule attributeID=&quot;principal&quot;&gt;<br>
&gt;                &lt;afp:PermitValueRule xsi:type=&quot;basic:ANY&quot; /&gt;<br>
&gt;        &lt;/afp:AttributeRule&gt;<br>
&gt;    &lt;/afp:AttributeFilterPolicy&gt;<br>
&gt;<br>
&gt; So that i could be able to get the above principal(email, acctType etc) at<br>
&gt; SP side in &#39;SAMLResponse&#39;.<br>
&gt;<br>
&gt;<br>
&gt; Common places to lookup additional information are a database or LDAP.<br>
&gt; - Here completely i am using our database, So there is no point of LDAP,<br>
&gt;  you are saying additional information, can it be &#39;permissions of the<br>
&gt; user&#39; which is from<br>
&gt; our database?<br>
&gt; - here how can get the required &#39;permission info&#39;(authorization) from our<br>
&gt; database,<br>
&gt; - How to write it in the attribute-resolver.xml by using DataConnectors to<br>
&gt; get the perms of user.<br>
&gt; Please provide me some example for configuration which i can get the<br>
&gt; &#39;permissions of user&#39;.<br>
<br>
</div></div>The distributed attribute-resolver.xml file has an example database Data<br>
Connector:<br>
<br>
     &lt;!-- Example Relational Database Connector --&gt;<br>
     &lt;!--<br>
     &lt;resolver:DataConnector id=&quot;mySIS&quot; xsi:type=&quot;dc:RelationalDatabase&quot;&gt;<br>
         &lt;dc:ApplicationManagedConnection jdbcDriver=&quot;oracle.jdbc.driver.OracleDriver&quot;<br>
                                          jdbcURL=&quot;jdbc:oracle:thin:@db.example.org:1521:SomeDB&quot;<br>
                                          jdbcUserName=&quot;myid&quot;<br>
                                          jdbcPassword=&quot;mypassword&quot; /&gt;<br>
         &lt;dc:QueryTemplate&gt;<br>
             &lt;![CDATA[<br>
                 SELECT * FROM student WHERE gzbtpid = &#39;$requestContext.principalName&#39;<br>
             ]]&gt;<br>
         &lt;/dc:QueryTemplate&gt;<br>
<br>
         &lt;dc:Column columnName=&quot;gzbtpid&quot; attributeID=&quot;uid&quot; /&gt;<br>
         &lt;dc:Column columnName=&quot;fqlft&quot; attributeID=&quot;gpa&quot; type=&quot;Float&quot; /&gt;<br>
     &lt;/resolver:DataConnector&gt;<br>
      --&gt;<br>
<br>
I use LDAP here, but this looks pretty easy to me.  Enter your connection<br>
string, a SQL query, and column-to-attributeID mapping.<br>
<span class=""><br>
&gt; After attribute resolution is complete, the Shibboleth IDP will filter<br>
&gt; those attributes according to the configuration in attribute-filter.xml.<br>
&gt; Only the attributes you configure will be released to the SP.<br>
&gt;<br>
&gt; The SP can then use those attributes to making authorization decisions.<br>
&gt; - &gt; Yes, if i can do configuration in attribute-resolver and<br>
&gt; attribute-filter.xml, i can use at SP side<br>
&gt;   from SAMLResponse.<br>
&gt; If you can provide me answers for my above questions, i think i can<br>
&gt; complete my task.<br>
<br>
</span>Keep asking questions, we&#39;ll keep trying to answer them.  :)<br>
<div class="HOEnZb"><div class="h5"><br>
        Andy<br>
--<br>
To unsubscribe from this list send an email to <a href="mailto:users-unsubscribe@shibboleth.net">users-unsubscribe@shibboleth.net</a><br>
</div></div></blockquote></div><br></div>