mardi 4 août 2015

White-listing an ip in spring project

I have a simple java application with login. It has a SecurityConfig class which extends WebSecurityConfigurerAdapter. And I have implemented couple of methods there

void configure(WebSecurity web)
void configure(HttpSecurity http)

In the configure(WebSecurity web) method, i'm ignoring authentication for certain URL's

public void configure(WebSecurity web) throws Exception {
    web
    .ignoring()
            .antMatchers(HttpMethod.POST, "/examplePattern");
}

Now I need to white-list a certain ip (which I have as a string array), which should be able to access only a specific endpoint. Basically something that is similar to the functionality of above code, ignoring authentication for the post request for a certain url pattern.

I'm quite new to this area, so if you have a solution for this problem, please let me know.

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire