Looking at creating a SpringBoot application with endpoints and screens where used configurable. Later other apps could use same endpoints, but they would be specified in the security db. Wonder if anyone has something which can help? Feels a bit like reinventing the wheel!
- Has secured endpoints
- Controlled/configurable by secure DB
- DB specified API permission per app, endpoint and screen
- Front-end app would do a call to get permissions, but of course back-end always do checks in case of tampering :). Expect FE will do check every so often and cache at login
Aware how to tie in Security and calls to SSO DB with user param.
@Component
final class TokenAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider {
@Autowired
private SsoService ssoService;
@Override
protected void additionalAuthenticationChecks(final UserDetails userDetails, final UsernamePasswordAuthenticationToken authentication) {
}
@Override
protected UserDetails retrieveUser(final String username, final UsernamePasswordAuthenticationToken authentication) {
final Object token = authentication.getCredentials();
return Optional
.ofNullable(token)
.map(String::valueOf)
.flatMap(ssoService::getSsoUser)
.orElseThrow(() -> new UsernameNotFoundException(String.format("Could not find the user with authentication token %s", token)));
}
}
class NoRedirectStrategy implements RedirectStrategy
class TokenAuthenticationFilter extends AbstractAuthenticationProcessingFilter
class SecurityConfiguration extends WebSecurityConfigurerAdapter
class TokenAuthenticationFilter extends AbstractAuthenticationProcessingFilter
class TokenAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider