You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by jleleu <le...@gmail.com> on 2014/07/14 13:20:46 UTC

Re: pac4j-buji spring xml support ?

Hi,

It should work with all these versions.

The pac4j and buji-pac4j library are meant to work for many identity
providers and *several ones at the same time*. So that's why you have two
main concepts:
- a client (like FacebookClient, TwitterClient...) defines a way to
authenticate via an identity provider (like Facebook, Twitter...)
- the Clients class is a way to group all the clients on the same callback
url (the idea is to have a /callback url with a specific parameter instead
of /callbackFacebook, /callbackTwitter... urls).

And the *ClientFilter* and *ClientRealm* work with *Clients*, not client
directly: would you mind checking that?

Thanks.
Best regards,


Jérôme LELEU
Founder of CAS in the cloud: www.casinthecloud.com | Twitter: @leleuj
Chairman of CAS: www.jasig.org/cas | Creator of pac4j: www.pac4j.org



2014-07-14 0:01 GMT+02:00 Frederik [via Shiro User] <
ml-node+s582556n7580078h86@n2.nabble.com>:

> Hi,
>
> I didn't manage to use Spring myself, so after some Googling I arrived at
> this post that says it should be possible.
> But even with the exact same config as posted above, it doesn't work...
>
> First error I receive with the example above is:
> "org.pac4j.core.exception.TechnicalException: callbackUrl cannot be blank"
> This can easily be overcome by fixing the culprit bean config like this:
>
> 	<bean id="facebookClient" class="org.pac4j.oauth.client.FacebookClient">
>  		<constructor-arg name="key" value="myAppId" />
> 		<constructor-arg name="secret" value="mySecret" />
> 		<property name="callbackUrl" value="http://myweb.com:8080/social-callback" />
>  	</bean>
>
> But then I get the exact same error I've tried to get rid of (for the past
> 2 hours...) in my own setup:
>
> org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clients' defined in ServletContext resource [/WEB-INF/spring/context-shiro.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.pac4j.core.client.Clients' to required type 'org.pac4j.core.client.Client[]' for property 'clients'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.pac4j.core.client.Clients] to required type [org.pac4j.core.client.Client] for property 'clients[0]': no matching editors or conversion strategy found
>
>
> Is my Spring version (v4.0.3.RELEASE) more pickier then yours?!
> Do I need to use another version of Pac4J (v1.5.1)?
> Or is my buji-pac4j (v1.2.3) the reason?
>
> Personally I am tempted to look at Spring to blame, but then again I've
> used similar Spring Bean definitions before...
> I've tried variations with explicit 'index' or adding 'type' attributes
> for the <constructor-arg> elements, even use <array> instead of <list> or
> just reference the 'facebookClient' directly, ..., Spring stubbornly
> continues to use this varargs ctor for some reason or another:
>
> public Clients(final String callbackUrl, final Client... clients)
>
>
> Anyway, if you still have a (complete) working setup, please post/sent it!
>
> Regards,
>
> Frederik
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://shiro-user.582556.n2.nabble.com/pac4j-buji-spring-xml-support-tp7579628p7580078.html
>  To start a new topic under Shiro User, email
> ml-node+s582556n582556h4@n2.nabble.com
> To unsubscribe from Shiro User, click here
> <http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=582556&code=bGVsZXVqQGdtYWlsLmNvbXw1ODI1NTZ8LTExNzY2MzcxMTY=>
> .
> NAML
> <http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://shiro-user.582556.n2.nabble.com/pac4j-buji-spring-xml-support-tp7579628p7580079.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: pac4j-buji spring xml support ?

Posted by jleleu <le...@gmail.com>.
Hi,

I don't have any sample based on Spring + Shiro. I'll try to figure
something out this week.
Best regards,

Jérôme LELEU
Founder of CAS in the cloud: www.casinthecloud.com | Twitter: @leleuj
Chairman of CAS: www.jasig.org/cas | Creator of pac4j: www.pac4j.org


2014-07-14 21:06 GMT+02:00 Frederik [via Shiro User] <
ml-node+s582556n7580080h48@n2.nabble.com>:

> Hi J=C3=A9r=C3=B4me,
>
> I did check that in my setup, and (besides that, in order to avoid being
> plagued by such an errors of not really understanding Shiro itself or the
> Pac4J extensions) I hence also checked the config of the previous post):
> None of the Spring configs get past the error I've mentioned in my
> previous
> post...
> Could you send me a (preferably Maven) project where such a Spring config
> does work?
>
> I really need to use the Spring setup as I have to use an existing
> UserService that is heavily 'wired' with a lot of other Spring beans, in a
> setup I didn't manage to duplicate in the shiro.ini (besides the fact that
> I prefer not to have such a setup as some 'singleton' beans will then
> exist
> twice...).
>
> Regards,
>
> Frederik
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://shiro-user.582556.n2.nabble.com/pac4j-buji-spring-xml-support-tp7579628p7580080.html
>  To start a new topic under Shiro User, email
> ml-node+s582556n582556h4@n2.nabble.com
> To unsubscribe from Shiro User, click here
> <http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=582556&code=bGVsZXVqQGdtYWlsLmNvbXw1ODI1NTZ8LTExNzY2MzcxMTY=>
> .
> NAML
> <http://shiro-user.582556.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://shiro-user.582556.n2.nabble.com/pac4j-buji-spring-xml-support-tp7579628p7580082.html
Sent from the Shiro User mailing list archive at Nabble.com.