Reply To: Multi tenancy configuration Spring Security

Splash Forums Rewrite Users Multi tenancy configuration Spring Security Reply To: Multi tenancy configuration Spring Security

#26396

BTW: The basic pattern for customizing the behavior of such a rule is to replace the operation with an anonymous class which may or may not delegate to some other options.

So this rule:

.addRule()
.when(Direction.isOutbound().and(Path.matches("/faces/home.xhtml")))
.perform(Substitute.with("/home"))

Is the same as:

.addRule()
.when( Direction.isOutbound().and( Path.matches( "/faces/home.xhtml" ) ) )
.perform( new HttpOperation() {
  @Override
  public void performHttp( HttpServletRewrite event, EvaluationContext context ) {
    Substitute.with( "/home" ).perform( event, context );
  }
} )

But it allows you to do stuff like:

.addRule()
.when( Direction.isOutbound().and( Path.matches( "/faces/home.xhtml" ) ) )
.perform( new HttpOperation() {
  @Override
  public void performHttp( HttpServletRewrite event, EvaluationContext context ) {

    if(event.getRequest().getRemoteHost().contains( "microsoft.com" )) {
      Substitute.with( "/foo" ).perform( event, context );
    } else {
      Substitute.with( "/bar" ).perform( event, context );
    }
    
  }
} )