Search in sources :

Example 1 with MotechRestBasicAuthenticationEntryPoint

use of org.motechproject.security.authentication.MotechRestBasicAuthenticationEntryPoint in project motech by motech.

the class SecurityRuleBuilder method addAuthenticationFilters.

private void addAuthenticationFilters(List<Filter> filters, MotechURLSecurityRule securityRule) {
    List<Scheme> supportedSchemes = securityRule.getSupportedSchemes();
    if (securityRule.isRest()) {
        if (supportedSchemes.contains(Scheme.BASIC)) {
            MotechRestBasicAuthenticationEntryPoint restAuthPoint = new MotechRestBasicAuthenticationEntryPoint(settingsFacade);
            BasicAuthenticationFilter basicAuthFilter = new BasicAuthenticationFilter(authenticationManager, restAuthPoint);
            filters.add(basicAuthFilter);
        }
    } else {
        if (supportedSchemes.contains(Scheme.USERNAME_PASSWORD)) {
            filters.add(usernamePasswordAuthenticationFilter);
        }
        if (supportedSchemes.contains(Scheme.OPEN_ID)) {
            filters.add(openIDAuthenticationFilter);
        }
    }
}
Also used : Scheme(org.motechproject.security.constants.Scheme) MotechRestBasicAuthenticationEntryPoint(org.motechproject.security.authentication.MotechRestBasicAuthenticationEntryPoint) BasicAuthenticationFilter(org.springframework.security.web.authentication.www.BasicAuthenticationFilter)

Aggregations

MotechRestBasicAuthenticationEntryPoint (org.motechproject.security.authentication.MotechRestBasicAuthenticationEntryPoint)1 Scheme (org.motechproject.security.constants.Scheme)1 BasicAuthenticationFilter (org.springframework.security.web.authentication.www.BasicAuthenticationFilter)1