java - Custom Bean for Authentication Policy - Conflict with obtain more parameters than just ticket - return more attributes cas jasig -
i'm configuring cas v4.1.1 , i'm trying return map of parameters, (plus ticket) on response client phpcas, of "custom bean" (that design based on bean org.jasig.cas.adaptors.jdbc.searchmodesearchdatabaseauthenticationhandler of subproject cas-server-support-jdbc) authenticate, used "primaryprincipalresolver" "authenticationmanager" bean used on deployerconfigcontext.xml
my configuration of deployerconfigcontext.xml looks this:
<beans xmlns="http://www.springframework.org/schema/beans" ... ... /> <bean id="authenticationmanager" class="org.jasig.cas.authentication.policybasedauthenticationmanager"> <constructor-arg> <map> <!-- | important | every handler requires unique name. | if more 1 instance of same handler class configured, must explicitly | set name other default name (typically simple class name). --> <entry key-ref="proxyauthenticationhandler" value-ref="proxyprincipalresolver" /> <!-- beans de autenticación: aquí se enlistan los beans que serán usados para la autenticación. dependiendo del orden en que se agreguen, se dará prioridad al método de autenticación que describa el bean. --> <entry key-ref="searchdatabaseauthenticationmovilred" value-ref="primaryprincipalresolver" /> </map> </constructor-arg> <!-- | defines security policy around authentication. alternative policies ship cas: | | * notpreventedauthenticationpolicy - credential must either pass or fail authentication | * allauthenticationpolicy - presented credential must authenticated | * requiredhandlerauthenticationpolicy - specifies handler must authenticate credential pass --> <property name="authenticationpolicy"> <bean class="org.jasig.cas.authentication.anyauthenticationpolicy" /> </property> </bean> ... .... <bean id="searchdatabaseauthenticationmovilred" class="com.solidda.cas.jdbc.searchdatabaseauthenticationmovilred"> <property name="urlservice"> <value> { url use point service return map of data } </value> </property> <property name="datasource" ref="datasource" /> </bean> ... <!-- required proxy ticket mechanism --> <bean id="proxyprincipalresolver" class="org.jasig.cas.authentication.principal.basicprincipalresolver" /> <!-- | resolves principal credential using attribute repository configured resolve | against deployer-specific store (e.g. ldap). --> <bean id="primaryprincipalresolver" class="org.jasig.cas.authentication.principal.persondirectoryprincipalresolver" p:principalfactory-ref="principalfactory" p:attributerepository-ref="attributerepository" /> <!-- bean defines attributes service may return. example uses stub/mock version. real implementation may go against database or ldap server. id should remain "attributerepository" though. + --> <bean id="attributerepository" class="org.jasig.services.persondir.support.namedstubpersonattributedao" p:backingmap-ref="attrrepobackingmap" /> <util:map id="attrrepobackingmap"> <entry key="uid" value="uid" /> <entry key="edupersonaffiliation" value="edupersonaffiliation" /> <entry key="groupmembership" value="groupmembership" /> <entry> <key> <value>memberof</value> </key> <list> <value>faculty</value> <value>staff</value> <value>org</value> </list> </entry> </util:map> ....
and looks code of "custom bean" create:
... public class searchdatabaseauthenticationmovilred extends abstractjdbcusernamepasswordauthenticationhandler { @notnull private string urlservice; /** * {@inheritdoc} */ @override protected final handlerresult authenticateusernamepasswordinternal( final usernamepasswordcredential credential) throws generalsecurityexception, preventedexception { //get data adquire user , password petition final string username = credential.getusername(); final string password = credential.getpassword(); .... //creates petition method call post service returns map of data .... //maps decompose result final map<string, object> result; final map<string, object> datavalues; //at end obtain map object bellow datavalues = new hashmap<string, object>(); datavalues.put("data", "{\"infologin\": {\"usua_login\": " + "\"username\",\"usua_id\": someid,\"tpte_id\": " + "type,\"terc_id\": othersomeid}"); //i send this, sending map method "createprincipal" map of result final handlerresult = createhandlerresult(credential, this.principalfactory.createprincipal(username, datavalues), null); return a; } .... //some more code , stuff
and can't obtain on response make on phpcas "datavalues" content, "attributes" or that. i'm screwed this, see lot of forums , nothing of works case... can guys me, please?
greetings colombia.
thank you.
-- cristian guerrero. developer verge of nervous breakdown
two things: 1. if wish use handler return attributes should null out corresponding principal resolver. 2. attributes should released cas clients per attribute release policy. should list attributes need released, i.e. data.
Comments
Post a Comment