Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8083657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:32:39+00:00 2026-06-05T17:32:39+00:00

In my web application that uses Apache Shiro for AuthC and AuthZ I have

  • 0

In my web application that uses Apache Shiro for AuthC and AuthZ I have two authentication realms: One for the regular web interface (called SsoRealm) and another one for the REST API (called RestRealm) using an API token. The principals authenticated by both realms have disjunct permissions (and AuthenticationTokens). If there is no pre-existing session and an API call arrives via the REST interface everything is fine and the authentication (and authorization) happens via the RestRealm. However, if there is an existing session previously authenticated via the
SsoRealm no authentication attempt via the RestRealm happens and the consecutive authorization check (using Subject.isPermitted) fails as the subject is from the wrong realm.

The corresponding authentication filters are registered as (using Shiro Guice):

addFilterChain("/api/x/*/y", REST_AUTH, NO_SESSION_CREATION);
addFilterChain("/**", SSO_AUTH);

Is there anything I can do to force a re-authentication with the “correct” realm?

Would a custom AuthenticationStrategy help (i.e., does the AuthenticationStrategy contract allow the implementation of a strategy “if RestRealm is involved, the RestRealm authentication needs to be successful”)? AFAICS ModularRealmAuthenticator.doMultiRealmAuthentication is not called again if there is an existing authenticated session…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:32:41+00:00Added an answer on June 5, 2026 at 5:32 pm

    As it turned out, this one was rather easy to solve: Just overwrite AuthenticatingFilter#isAccessAllowed to make sure that the ‘right’ principal type is authenticated for your realm (the default implementation just uses Subject#isAuthenticated to test whether any principal is authenticated – no matter whether it fits the realm or not).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that uses two databases. DB1 Users perform their CRUD
I've deployed an Apache Wicket web-application that uses Spring and Hibernate to my Tomcat
I have a web application that uses TONS of javascript, and as usual, there
I have a web application that uses AzMan authorization to grant different functionality to
I have a php web application that uses big cookies to store a lot
I have an older web application that uses a MySQL Database (MYISAM). I noticed
I have a web application that uses the CDO Message object to email reports.
I have made a web application that uses master page for Login & Logout
I have a web application that uses a library which resides in TOMCAT_HOME/common/lib. This
I have developed a web application that uses the jQuery DateTimePicker by Trent Richardson

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.