Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: Authorize on two or more web applications simultaneously

  1. #1
    Join Date
    Jul 2012
    Posts
    22

    Default Authorize on two or more web applications simultaneously

    Hi,

    can you please give me a hint, how to authorize user on few web applications at the same time?

    I have:

    - EAR
    - - WAR 1 (example.com/)
    - - WAR 2 (example.com/shop/)
    - - ...
    - - WAR n (example.com/forum/)


    Every WAR is a Spring (+Security) based application. User is authenticated and authorized on WAR 1. When he swithes to any other WAR, he have to pass authentication again. How to bypass it?

    Thanks.

    - Lsync

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Use a SSO solution (Single Sign On) ... You pass a SSO token around which is checked with the server.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2012
    Posts
    22

    Default

    Hi Marten,

    thanks for reply. Do you know any non-server specific SSO solution(-s)? I will be grateful for the links.

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    I suggest google and I don't quite understand your non-server specific part... The whole point of SSO is to be server agnostic else it beats the purpose of SSO (SSO is broader then web applications!).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Jul 2012
    Posts
    22

    Default

    Sorry for my bad language. I mean "no 'server-specific'", because the only reasonable SSO solution that I can find - is to use SSO Valve for Tomcat/JBoss. So it will be great to find more versatile way. Can you help with this?

    Also I found that "remember-me" cookie can help, but this hack brokes standard "remember me" functionality. Too bad.

    Or maybe I can programmatically log-in user in all my Spring Security guarded applications, when he authorizes in one of them?

  6. #6
    Join Date
    Jun 2010
    Posts
    10

    Default

    I think you want a "server-specific" solution as all of your web apps are deployed on the same app server, let alone the same ear. Do not confuse "server-specific" with vendor lock in. The SSO Valve for Tomcat, the LTPA cookie for Websphere, etc.. all work the same way. The container will populate the request.getUserPrincipal for you. You can use Spring's J2eePreAuthenticatedProcessingFilter to leverage this.

    If you want true SSO across different domains, you would have to use CAS or SAML or some other proprietary vendor (i.e. Siteminder). This is way more difficult.

    Good luck.

  7. #7
    Join Date
    Jul 2012
    Posts
    22

    Default

    Guys,

    according to this:
    http://static.springsource.org/sprin...rence/cas.html
    and this:
    https://wiki.jasig.org/display/CASC/...pring+Security

    I must give access to user's credentials (including passwords!) both to CAS and (every) web application. CAS needs them for authentication, and applications - for authorization and assigning a role. Am I right?

  8. #8
    Join Date
    Jan 2008
    Posts
    1,834

    Default

    The documentation may be a bit misleading unless you read the details. The passwords are not used when authenticating with CAS, but Spring Security does require a way to determine which roles the user has. This can be done using the UserDetailsService (which also provides passwords but they can be null values since they are not used) or it can be done using the GrantedAuthorityFromAssertionAttributesUserDetails Service set on the CasAuthenticationProvider instead. In this instance you must be sure to setup the CAS server to return the roles in the CAS response.
    Rob Winch
    Twitter @rob_winch
    Spring Security Lead
    Spring by Pivotal

  9. #9
    Join Date
    Jul 2012
    Posts
    22

    Default

    Done this part, thank you guys for help. I've tried CAS, OAuth for Spring Security and Remember-me cookie alone as SSO solutions. All works perfect, but has its own pros and cons.

    Next step I want to implement - to have all the best of two worlds: CAS and remember-me. First I'll explain why:
    - I want to use CAS as an enterprise solution;
    - each application is developing by its own team, so they are independent from each other (have their own sessions);
    - I want to emmediately authorize user in all applications, when he/she is authenticated with CAS.

    So I plan to use this simple scheme:
    1. Each application is configured to have both CAS and remember-me as authentication providers.
    2. When user is authenticated by any application, this application sets remember-me cookie, that visible to all (path="/" and domain=".exmple.com").
    3. When any other application see this cookie, it automatically authorises the user (full workflow drawing).

    It's the simplest way I see to make SSO on both protected and unprotected pages (I need SSO on unprotected pages to render user name on them).

    The question is: will that scheme work properly, or I have to research another one?

  10. #10
    Join Date
    Dec 2008
    Location
    New York City
    Posts
    135

    Default

    Look at CAS's single signon/off functionality. Your rememberme approach won't work because none of your applications will have access to the other's cookies.

    Also - note that having authentication to non protected pages is a security issue.
    Andrew Thompson - Linked In

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •