1

Does anyone know how to provide spring security authentication using DynamoDB? In other words, how would you convert/represent the following configAuthentication method using DynamoDB?

@Autowired
public void configAuthentication(AuthenticationManagerBuilder auth) 
throws Exception {
    auth.jdbcAuthentication().dataSource(dataSource)
            .usersByUsernameQuery("select username, password, enabled from appuser where username = ?")
            .authoritiesByUsernameQuery("select username, rolename from appuser natural join user_role natural join role where username = ?;");
}
1

1 Answer 1

3

You can use anything as a Spring Security authentication backend. You would need to write custom query logic in a class that implements the UserDetailsService interface and return a domain object that implements the UserDetails interface, but you can use that class.

Your configuration would like something like

  @Override
  public void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.userDetailsService(myCustomDynamoDbDetailService);
}

Where myCustomDynamoDBDetailService is your class that implements UserDetailService and does the lookup by username from DynamoDB.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.