Sure.

Inside the CAS server, one authentication attribute stores the provider
used for authentication:
https://github.com/Jasig/cas/blob/master/cas-server-support-pac4j/src/main/java/org/jasig/cas/support/pac4j/authentication/ClientAuthenticationMetaDataPopulator.java#L47
.

Moreover, the principal id is automatically build according to the provider
used for authentication and the provider can be retrieved using the
```ProfileHelper``` class:
https://github.com/leleuj/pac4j/blob/master/pac4j-core/src/main/java/org/pac4j/core/profile/ProfileHelper.java#L41
.

Everything is explained in the documentation:
https://wiki.jasig.org/pages/viewpage.action?pageId=56164890.

Best regards,
Jérôme



2014/1/20 Sashika <[email protected]>

> Thanks, it works perfectly now.
> Once the CAS is authenticated through facebook/twitter is there a way
> which we can identify from which social network the user logged in? Because
> in the oauth2.0/profile JSON we do not have that information.
>
> Thanks
>
>
> On Fri, Jan 17, 2014 at 8:01 PM, Jérôme LELEU <[email protected]> wrote:
>
>> Hi,
>>
>> Indeed. The problem has been fixed both on pac4j 1.4.2-SNAPSHOT (bug
>> fixes version) and pac4j 1.5.0-SNAPSHOT (next version).
>> It should work using pac4j 1.4.2-SNAPSHOT instead of pac4j 1.4.1 which is
>> automatically retrieved with the CAS server 4.0.
>> Best regards,
>> Jérôme
>>
>>
>>
>> 2014/1/17 Sashika <[email protected]>
>>
>>> After twitter changing their api access to SSL/TLS on 14th Jan, CAS
>>> cannot login through Twitter. The exception is as below.
>>>
>>> StandardWrapperValve[cas]: PWC1406: Servlet.service() for servlet cas
>>> threw exception org.scribe.exceptions.OAuthException: Response body is
>>> incorrect. Can't extract token and secret from this: 'Failed to exchange
>>> tokens' at
>>> org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:41)
>>> at
>>> org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:27)
>>> at
>>> org.scribe.oauth.ProxyOAuth10aServiceImpl.getAccessToken(ProxyOAuth10aServiceImpl.java:103)
>>> at
>>> org.pac4j.oauth.client.BaseOAuth10Client.getAccessToken(BaseOAuth10Client.java:110)
>>> at
>>> org.pac4j.oauth.client.BaseOAuthClient.retrieveUserProfile(BaseOAuthClient.java:163)
>>> at
>>> org.pac4j.oauth.client.BaseOAuthClient.retrieveUserProfile(BaseOAuthClient.java:44)
>>> at org.pac4j.core.client.BaseClient.getUserProfile(BaseClient.java:147) at
>>> org.pac4j.core.client.BaseClient.getUserProfile(BaseClient.java:52) at
>>> org.jasig.cas.support.pac4j.authentication.handler.support.ClientAuthenticationHandler.doAuthentication(ClientAuthenticationHandler.java:80)
>>> at
>>> org.jasig.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler.authenticate(AbstractPreAndPostProcessingAuthenticationHandler.java:78)
>>> at
>>> org.jasig.cas.authentication.PolicyBasedAuthenticationManager.authenticateInternal(PolicyBasedAuthenticationManager.java:211)
>>> at
>>> org.jasig.cas.authentication.PolicyBasedAuthenticationManager.authenticate(PolicyBasedAuthenticationManager.java:143)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> at
>>>
>>> ------------------------
>>> ------------------------
>>> StandardWrapperValve[cas]: PWC1406: Servlet.service() for servlet cas
>>> threw exception java.lang.IllegalArgumentException: Cannot get String from
>>> a null object at
>>> org.scribe.utils.Preconditions.check(Preconditions.java:82) at
>>> org.scribe.utils.Preconditions.checkNotNull(Preconditions.java:29) at
>>> org.scribe.utils.StreamUtils.getStreamContents(StreamUtils.java:20) at
>>> org.scribe.model.Response.parseBodyContents(Response.java:41) at
>>> org.scribe.model.Response.getBody(Response.java:67) at
>>> org.pac4j.oauth.client.BaseOAuthClient.sendRequestForData(BaseOAuthClient.java:235)
>>> at
>>> org.pac4j.oauth.client.BaseOAuthClient.retrieveUserProfileFromToken(BaseOAuthClient.java:201)
>>> at
>>> org.pac4j.oauth.client.BaseOAuthClient.retrieveUserProfile(BaseOAuthClient.java:164)
>>> at
>>> org.pac4j.oauth.client.BaseOAuthClient.retrieveUserProfile(BaseOAuthClient.java:44)
>>> at org.pac4j.core.client.BaseClient.getUserProfile(BaseClient.java:147) at
>>> org.pac4j.core.client.BaseClient.getUserProfile(BaseClient.java:52) at
>>> org.jasig.cas.support.pac4j.authentication.handler.support.ClientAuthenticationHandler.doAuthentication(ClientAuthenticationHandler.java:80)
>>> at
>>> org.jasig.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler.authenticate(AbstractPreAndPostProcessingAuthenticationHandler.java:78)
>>> at
>>> org.jasig.cas.authentication.PolicyBasedAuthenticationManager.authenticateInternal(PolicyBasedAuthenticationManager.java:211)
>>> at
>>> org.jasig.cas.authentication.PolicyBasedAuthenticationManager.authenticate(PolicyBasedAuthenticationManager.java:143)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>> at
>>>
>>>
>>> On Mon, Jan 13, 2014 at 7:23 PM, Jérôme LELEU <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> The documentation for OAuth client support in CAS 4.0 is here:
>>>> https://wiki.jasig.org/pages/viewpage.action?pageId=56164890.
>>>> It's pretty similar between 3.5 and 4.0, except that the classes has
>>>> been renamed from *Provider to *Client. Here is the Javadoc for clients:
>>>> http://www.pac4j.org/apidocs/pac4j/.
>>>> And the demo for CAS 4.0:
>>>> https://github.com/leleuj/cas-pac4j-oauth-demo.
>>>> Best regards,
>>>> Jérôme
>>>>
>>>>
>>>>
>>>> 2014/1/13 Sashika <[email protected]>
>>>>
>>>>>  For 3.5 I can find the config for Google, Yahoo and LinkedIn through
>>>>> the below url
>>>>>
>>>>> https://wiki.jasig.org/display/CASUM/Configuration+for+the+OAuth+client+support+in+CAS+server+version+3.5.0
>>>>>
>>>>> But for CAS version 4 I cant find what are the config for these three
>>>>> logins. Can anyone please show me the correct configs or a relevant link.
>>>>>
>>>>> Thanks.
>>>>>
>>>>> --
>>>>> 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
>
>

-- 
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

Reply via email to