Perfect. That makes a lot of sense. Thank you!
On Sat, Apr 5, 2014 at 9:07 AM, Michael Wechner <[email protected]>wrote: > I have configured my custom components inside > > cas-server-webapp-3.5.2/WEB-INF/deployerConfigContext.xml > > whereas the custom principal resolver: > > <property name="credentialsToPrincipalResolvers"> > <list> > <bean > class="com.wyona.cas.authentication.MyCredentialsToPrincipalResolver"/> > <!-- > <bean > > class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" > > > <property > name="attributeRepository" ref="attributeRepository" /> > </bean> > --> > > > and the custom authenticator: > > > <!-- > <bean > > class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" > /> > --> > <bean > class="com.wyona.cas.authentication.MyAuthenticationHandler"> > ... > </bean> > > HTH > > Michael > > > > > Am 05.04.14 14:56, schrieb Al Krinker: > > Thank you for replying Michael! > > > > Like I suspected... I would have to tweak the internals since I could not > > find any simple API to do it for me... > > > > One more question. At which point do you invoke your custom methods? > After > > I set up my Restful API for the CAS. I followed this example ( > > http://www.dzone.com/snippets/cas-restful-java-client) to get > authenticated > > and to retrieve the ticket and such. > > > > Thank you > > Al > > > > > > On Sat, Apr 5, 2014 at 1:52 AM, Michael Wechner > > <[email protected]>wrote: > > > >> I have written my own PrincipalResolver based on > >> > >> CredentialsToPrincipalResolver > >> > >> in order to return the firstname of the user: > >> > >> public final Principal resolvePrincipal(final Credentials credentials) { > >> > >> final Map<String, Object> attributes = new HashMap<String, > >> Object>(); > >> > >> attributes.put("firstname", ((MyFirstnamePasswordCredentials) > >> credentials).getFirstame()); > >> > >> return new SimplePrincipal(principalId, attributes); > >> } > >> > >> whereas I have overritten > >> > >> RememberMeUsernamePasswordCredentials > >> > >> by adding methods like for example > >> > >> getFirstname() > >> > >> and > >> > >> setFirstname(String firstname) > >> > >> > >> whereas setFirstname() is then used in my custom implementation of > >> > >> > >> > AbstractUsernamePasswordAuthenticationHandler.authenticateUsernamePasswordInternal(final > >> UsernamePasswordCredentials credentials) > >> > >> > >> HTH > >> > >> Michael > >> > >> > >> > >> > >> Am 05.04.14 03:31, schrieb Al Krinker: > >>> Anyone has an example of how I can get a username from CAS (not from > jsp > >>> request.getPrinciple())? > >>> > >>> trying to make restful call to CAS and then read in username returned. > >>> > >>> Also, trying to read other attributes like surname, firstname, ec... > any > >>> examples will be appreciated as well > >>> > >> > >> -- > >> 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
