Scott,

Sorry for replaying to late.

I have written the custom CredentialsToPrincipalResolver to change the
Principal object to "*test*" but for some reasons it is not working for me.

I've attached the source file and configuration file.

Could you please help me with this?


Thanks,
Mayank
On Fri, Jun 11, 2010 at 7:42 AM, Scott Battaglia
<[email protected]>wrote:

> Is it dynamic per request?  Otherwise, write a custom
> CredentialsToPrincipalResolver to do what you need.
>
> Cheers,
> Scott
>
>
>
>
> On Thu, Jun 10, 2010 at 1:33 AM, Mayank Mishra 
> <[email protected]>wrote:
>
>> Yes. Basically I want to change the principle object. So it may be by
>> means of prefix value or something else.
>>
>> Can we do this? What would be the best way?
>>
>> Thanks,
>> Mayank
>>
>> On Thu, Jun 10, 2010 at 9:17 AM, Scott Battaglia <
>> [email protected]> wrote:
>>
>>> You mean you want to alter the principal's ID and prefix it with
>>> something? I.e. if my id was "battags" you want it to be "MYPREFIX-battags"
>>> ?
>>>
>>>
>>>  On Wed, Jun 9, 2010 at 3:04 PM, Mayank Mishra <
>>> [email protected]> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I'm using CAS 3.0 server. I want to modify the Principle object at
>>>> runtime i.e I want to attach some prefix value to the Principle object.
>>>>
>>>> Could someone please help me with this?
>>>>
>>>>
>>>> Thanks,
>>>> Mayank
>>>>
>>>> --
>>>> You are currently subscribed to [email protected] as: 
>>>> [email protected]
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> To unsubscribe, change settings or access archives, see 
>>>> http://www.ja-sig.org/wiki/display/JSG/cas-user
>>>>
>>>>
>>>  --
>>> You are currently subscribed to [email protected] as: 
>>> [email protected]
>>>
>>>
>>>
>>> To unsubscribe, change settings or access archives, see 
>>> http://www.ja-sig.org/wiki/display/JSG/cas-user
>>>
>>>
>>  --
>> You are currently subscribed to [email protected] as: 
>> [email protected]
>>
>>
>> To unsubscribe, change settings or access archives, see 
>> http://www.ja-sig.org/wiki/display/JSG/cas-user
>>
>>
>  --
> You are currently subscribed to [email protected] as: 
> [email protected]
> To unsubscribe, change settings or access archives, see 
> http://www.ja-sig.org/wiki/display/JSG/cas-user
>
>

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Attachment: UsernamePasswordCredentialsToPrincipalResolver.java
Description: Binary data

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:p="http://www.springframework.org/schema/p";
       xmlns:sec="http://www.springframework.org/schema/security";
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd";>
      
	<bean
		id="authenticationManager"
		class="org.jasig.cas.authentication.AuthenticationManagerImpl">
		<property name="credentialsToPrincipalResolvers">
			<list>
				<bean class="com.test.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" />
				<bean class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
			</list>
		</property>

		<property name="authenticationHandlers">
			<list>
				<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"  p:httpClient-ref="httpClient" p:requireSecure="false"/>
				<bean class="org.acegisecurity.adapters.cas3.CasAuthenticationHandler">
					<property name="authenticationManager" ref="acegiAuthenticationManager" />
				</bean>
			</list>
		</property>
	</bean>


	<bean id="inMemoryDaoImpl" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
		<property name="userMap">
			<value>
				nikhil=jain,ROLES_IGNORED_BY_CAS
				sobin=daniel,ROLES_IGNORED_BY_CAS
				mayank=mishra,ROLES_IGNORED_BY_CAS
				prashant=thakkar,disabled,ROLES_IGNORED_BY_CAS
				test=test,ROLES_IGNORED_BY_CAS
			</value>
		</property>
	</bean>

	<bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
		<property name="userDetailsService"><ref bean="inMemoryDaoImpl"/></property>
	</bean>

	<bean id="acegiAuthenticationManager" class="org.acegisecurity.providers.ProviderManager">
		<property name="providers">
		  <list>
			<ref bean="daoAuthenticationProvider"/>
		  </list>
		</property>
	</bean>	
	
	<sec:user-service id="userDetailsService">
        <sec:user name="@@THIS SHOULD BE REPLACED@@" password="notused" authorities="ROLE_ADMIN" />
    </sec:user-service>	
			
	<!-- 
	Bean that defines the attributes that a service may return.  This example uses the Stub/Mock version.  A real implementation
	may go against a database or LDAP server.  The id should remain "attributeRepository" though.
	 -->
	<bean id="attributeRepository"
		class="org.jasig.services.persondir.support.StubPersonAttributeDao">
		<property name="backingMap">
			<map>
				<entry key="uid" value="uid" />
				<entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> 
				<entry key="groupMembership" value="groupMembership" />
			</map>
		</property>
	</bean>
	
	<!-- 
	Sample, in-memory data store for the ServiceRegistry. A real implementation
	would probably want to replace this with the JPA-backed ServiceRegistry DAO
	The name of this bean should remain "serviceRegistryDao".
	 -->
	<bean
		id="serviceRegistryDao"
		class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl" />
</beans>

Reply via email to