I figured it out.

Added a name to my jaas definition - 

cas.properties:
#JAAS DEV
cas.authn.jaas[0].name=jaas_dev
cas.authn.jaas[0].realm=DevLogin
cas.authn.jaas[0].login-config-type=JavaLoginConfig
cas.authn.jaas[0].login-configuration-file=/opt/apache-tomcat-9.0.60/conf/jaas.conf
cas.authn.jaas[0].password-encoder.encoding-algorithm=MD5
cas.authn.jaas[0].password-encoder.type=NONE

#JAAS PROD
cas.authn.jaas[0].name=jaas_prod
cas.authn.jaas[1].realm=ProdLogin
cas.authn.jaas[1].login-config-type=JavaLoginConfig
cas.authn.jaas[1].login-configuration-file=/opt/apache-tomcat-9.0.60/conf/jaas.conf
cas.authn.jaas[1].password-encoder.encoding-algorithm=MD5
cas.authn.jaas[1].password-encoder.type=NONE

Added authenticationPolicy to my service definitions - 

{
  @class: org.apereo.cas.services.RegexRegisteredService
  serviceId: ^https://(somesite|192.168.1.2)/.*
  name: dev 
  theme: dev
  id: 8675309
  proxyTicketExpirationPolicy:
  {
    @class: 
org.apereo.cas.services.DefaultRegisteredServiceProxyTicketExpirationPolicy
  }
  serviceTicketExpirationPolicy:
  {
    @class: 
org.apereo.cas.services.DefaultRegisteredServiceServiceTicketExpirationPolicy
  }
  evaluationOrder: 2
  attributeReleasePolicy:
  {
    @class: org.apereo.cas.services.ReturnAllAttributeReleasePolicy
  }
  authenticationPolicy:
  {
    @class: 
org.apereo.cas.services.DefaultRegisteredServiceAuthenticationPolicy
    requiredAuthenticationHandlers:
    [
      java.util.HashSet
      [
        jaas_dev
      ]
    ]
    criteria:
    {
      @class: 
org.apereo.cas.services.AllowedAuthenticationHandlersRegisteredServiceAuthenticationPolicyCriteria
    }
  }
}
On Thursday, September 15, 2022 at 3:05:29 PM UTC-5 cm wrote:

> Hello, I'm trying to to use multiple jaas realms, one for my development 
> environment and one for my production environment. If my first jaas realm 
> fails to authenticate (cas.authn.jaas[0]) I want it to try my other realm 
> (cas.authn.jaas[1]).  However when testing, my second realm is never 
> evaluated.  Is it possible to fallback to cas.authn.jaas[1] if 
> cas.authn.jaas[0] fails to authenticate?
>
> Thanks in advance!
>
>
> cas.properties:
> #JAAS DEV
> cas.authn.jaas[0].realm=DevLogin
> cas.authn.jaas[0].login-config-type=JavaLoginConfig
>
> cas.authn.jaas[0].login-configuration-file=/opt/apache-tomcat-9.0.60/conf/jaas.conf
> cas.authn.jaas[0].password-encoder.encoding-algorithm=MD5
> cas.authn.jaas[0].password-encoder.type=NONE
>
> #JAAS PROD
> cas.authn.jaas[1].realm=ProdLogin
> cas.authn.jaas[1].login-config-type=JavaLoginConfig
>
> cas.authn.jaas[1].login-configuration-file=/opt/apache-tomcat-9.0.60/conf/jaas.conf
> cas.authn.jaas[1].password-encoder.encoding-algorithm=MD5
> cas.authn.jaas[1].password-encoder.type=NONE
>
>
>
> jaas.conf:
> //DEV ENV
> DevLogin {
>         someorg.auth.dev.MyLogin required
>                 debug="true"
>                 DataSourceName="jdbc/DEVDB" ;
> } ;
>
> //PROD ENV
> ProdLogin {
>         someorg.auth.prod.MyLogin required
>         debug="true"
>         DataSourceName="jdbc/PRODDB" ;
> } ;

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/ed778e33-4176-4082-b30f-6a1518363284n%40apereo.org.

Reply via email to