Search in sources :

Example 1 with StaticUserDataProvider

use of com.predic8.membrane.core.interceptor.authentication.session.StaticUserDataProvider in project service-proxy by membrane.

the class BasicAuthenticationInterceptorIntegrationTest method testHashedPassword.

@Test
public void testHashedPassword() throws Exception {
    List<User> users = new ArrayList<User>();
    User user = new User("admin", "$6$12345678$jwCsYagMo/KNcTDqnrWL25Dy3AfAT5U94abA5a/iPFO.Cx2zAkMpPxZBNKY/P/xiRrCfCFDxdBp7pvNEMoBcr0");
    users.add(user);
    BasicAuthenticationInterceptor interceptor = new BasicAuthenticationInterceptor();
    StaticUserDataProvider provider = (StaticUserDataProvider) interceptor.getUserDataProvider();
    interceptor.setUsers(users);
    User postData = new User("admin", "admin");
    try {
        provider.verify(postData.getAttributes());
    } catch (Exception e) {
        fail();
    }
}
Also used : User(com.predic8.membrane.core.interceptor.authentication.session.StaticUserDataProvider.User) ArrayList(java.util.ArrayList) StaticUserDataProvider(com.predic8.membrane.core.interceptor.authentication.session.StaticUserDataProvider) IOException(java.io.IOException) Test(org.junit.Test)

Example 2 with StaticUserDataProvider

use of com.predic8.membrane.core.interceptor.authentication.session.StaticUserDataProvider in project service-proxy by membrane.

the class OAuth2AuthorizationServerInterceptorBase method setOasiUserDataProvider.

private void setOasiUserDataProvider() {
    StaticUserDataProvider udp = new StaticUserDataProvider();
    ArrayList<StaticUserDataProvider.User> users = new ArrayList<StaticUserDataProvider.User>();
    johnsUserData = new StaticUserDataProvider.User("john", "password");
    johnsUserData.getAttributes().put("email", "e@mail.com");
    users.add(johnsUserData);
    udp.setUsers(users);
    oasi.setUserDataProvider(udp);
}
Also used : StaticUserDataProvider(com.predic8.membrane.core.interceptor.authentication.session.StaticUserDataProvider)

Aggregations

StaticUserDataProvider (com.predic8.membrane.core.interceptor.authentication.session.StaticUserDataProvider)2 User (com.predic8.membrane.core.interceptor.authentication.session.StaticUserDataProvider.User)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1