You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Richard Mixon <rn...@custco.biz> on 2014/03/21 02:32:55 UTC

Setting "unauthorizedUrl" when using CAS, Shiro and Guice

My CAS/Shiro/Guice integration has been working fine. But I'm not exactly
sure how to specify the "unauthorizedUrl" given that we have done all our
configuration without using an ini file.

Some help or direction would be appreciated.

Here's the gist of our ShiroWebModule:

public class HBShiroWebModule extends ShiroWebModule {
    HBShiroWebModule(ServletContext sc) {
        super(sc);
    }

    @Override
    public void configure() {
        super.configure();
    }

    @SuppressWarnings("unchecked")
    protected void configureShiroWeb() {
        try {
            this.
            bindRealm().to(InjectableCasRealm.class);
            ShiroWebModule.guiceFilterModule();
        } catch (Exception e) {
            addError(e);
        }
        expose(RolesAuthorizationFilter.class);
        addFilterChain("/public", ANON);
        addFilterChain("/private", ROLES, config(ROLES, "HB_USER"));
        Key<InjectableCasFilter> casFilter =
Key.get(InjectableCasFilter.class);
        addFilterChain("/shiro-cas", casFilter);
        expose(InjectableCasFilter.class);
    }
}

We are injecting the other properties (e.g. failureUrl, loginUrl) to our
InjectableCasFilter and InjectableCasRealm.

Thanks!

 - Richard

-- 
Richard Mixon
Custom Computer Creations, L.L.C.
mobile: (480) 577-6834 office: (480) 614-3442
email: rnmixon@CustCo.biz <ma...@CustCo.biz>
Microsoft Partner ID: 1263725
The messages and documents transmitted with this notice contain
confidential information belonging to the sender. If you are not the
intended recipient of this information, you are hereby notified that any
disclosure, copying, distribution or use of the information is strictly
prohibited. If you have received this transmission in error, please notify
the sender immediately.

Re: Setting "unauthorizedUrl" when using CAS, Shiro and Guice

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

I'm definitely not a Guice specialist, but someone provided me a demo
configred with Guice for my own buji-pac4j-demo.
So I think you can find inside it some good examples:
https://github.com/vonZeppelin/buji-guice-demo.
Best regards,
Jérôme



2014-03-21 2:34 GMT+01:00 rnmixon [via Shiro User] <
ml-node+s582556n7579816h64@n2.nabble.com>:

> My CAS/Shiro/Guice integration has been working fine. But I'm not exactly
> sure how to specify the "unauthorizedUrl" given that we have done all our
> configuration without using an ini file.
>
> Some help or direction would be appreciated.
>
> Here's the gist of our ShiroWebModule:
>
> public class HBShiroWebModule extends ShiroWebModule {
>     HBShiroWebModule(ServletContext sc) {
>         super(sc);
>     }
>
>     @Override
>     public void configure() {
>         super.configure();
>     }
>
>     @SuppressWarnings("unchecked")
>     protected void configureShiroWeb() {
>         try {
>             this.
>             bindRealm().to(InjectableCasRealm.class);
>             ShiroWebModule.guiceFilterModule();
>         } catch (Exception e) {
>             addError(e);
>         }
>         expose(RolesAuthorizationFilter.class);
>         addFilterChain("/public", ANON);
>         addFilterChain("/private", ROLES, config(ROLES, "HB_USER"));
>         Key<InjectableCasFilter> casFilter =
> Key.get(InjectableCasFilter.class);
>         addFilterChain("/shiro-cas", casFilter);
>         expose(InjectableCasFilter.class);
>     }
> }
>
> We are injecting the other properties (e.g. failureUrl, loginUrl) to our
> InjectableCasFilter and InjectableCasRealm.
>
> Thanks!
>
>  - Richard
>
> --
> Richard Mixon
> Custom Computer Creations, L.L.C.
> mobile: (480) 577-6834 office: (480) 614-3442
> email: [hidden email]<http://user/SendEmail.jtp?type=node&node=7579816&i=0><mailto:[hidden
> email] <http://user/SendEmail.jtp?type=node&node=7579816&i=1>>
> Microsoft Partner ID: 1263725
> The messages and documents transmitted with this notice contain
> confidential information belonging to the sender. If you are not the
> intended recipient of this information, you are hereby notified that any
> disclosure, copying, distribution or use of the information is strictly
> prohibited. If you have received this transmission in error, please notify
> the sender immediately.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://shiro-user.582556.n2.nabble.com/Setting-unauthorizedUrl-when-using-CAS-Shiro-and-Guice-tp7579816.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.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-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/Setting-unauthorizedUrl-when-using-CAS-Shiro-and-Guice-tp7579816p7579818.html
Sent from the Shiro User mailing list archive at Nabble.com.