Phillip Steffensen
Phillip Steffensen

Reputation: 325

Spring Security using JBoss <security-domain>

i'm building an application using Spring Security with an Java based @Configuration. Our JBoss EAP 6 Server has a security-domain configured which is defined in the jboss-web.xml-File.

jboss-web.xml

<!DOCTYPE jboss-web PUBLIC
    "-//JBoss//DTD Web Application 4.2//EN"
    "http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd">
<jboss-web>
    <security-domain>ldapcomponent</security-domain> 
</jboss-web>

Is there a way to use this security-domain within my Spring Security WebSecurityConfigurerAdapter?

Spring Security Java Configuration

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth.?????
    }

    @Override
    protected void configure(final HttpSecurity http) throws Exception {
        http.authorizeRequests().anyRequest().authenticated()
            .anyRequest().hasRole("my-required-role").and().httpBasic();
    }
}

Upvotes: 2

Views: 3414

Answers (1)

Phillip Steffensen
Phillip Steffensen

Reputation: 325

JBoss Authentication requires a

org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider

which can be added by the Method:

auth.authenticationProvider(...);

In Addition to that a

org.springframework.security.web.authentication.preauth.j2ee.J2eePreAuthenticatedProcessingFilter 

should be registered.

Upvotes: 2

Related Questions