我们有一个权利数据库,其中包含应用程序ID,角色和用户映射到每个应用程序的角色.遵循线程建议如何基于resourceId将用户角色映射到oauth2范围/权限?
忽略我上面提到的权利数据库,我是否根据下面代码中的user和resourceId将角色"USER","READER","WRITER"映射到oauth2范围/权限?
用户认证/授权配置
@Configuration
@Order(-10)
protected static class LoginConfig extends WebSecurityConfigurerAdapter {
....
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// auth.parentAuthenticationManager(authenticationManager);
// @formatter:off
auth.inMemoryAuthentication()
.withUser("admin").password("admin")
.roles("ADMIN", "USER", "READER", "WRITER")
.and()
.withUser("user").password("password")
.roles("USER")
.and()
.withUser("audit").password("audit")
.roles("USER", "ADMIN", "READER");
// @formatter:on
}
}
Run Code Online (Sandbox Code Playgroud)
OAuth2配置
@Configuration
@EnableAuthorizationServer
protected static class OAuth2Config extends AuthorizationServerConfigurerAdapter {
@Autowired
private AuthenticationManager authenticationManager;
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
// @formatter:off
clients.inMemory()
.withClient("acme").secret("acmesecret")
.authorizedGrantTypes("authorization_code", "refresh_token", "password")
.scopes("openid")
.and() …Run Code Online (Sandbox Code Playgroud) 如何在Spring Data REST 资源的根列表中公开外部资源(不通过存储库管理)?我在Restbucks中按照模式定义了一个控制器
如何使用Spring Data Rest启用缓存?
其背后的原因是,一旦应用程序启动,存储库列表和搜索方法就不会改变.此外,如果其余API背后的数据仅通过rest API进行更改,那么它也会启用缓存数据.
我相信某些级别是缓存发生在REST API框架中,如果缓存发生在最终响应阶段,即json响应(以避免将对象编组到json的开销),这将是理想的
思想/评论?
我有一个用例,我的应用程序托管REST API和Web应用程序,我们只需要向REST API添加自定义标头.REST API通过Spring Data REST启用.通常我们可以使用Servlet Filter来实现这一点,但我们需要编写将请求隔离到REST API并添加自定义头的逻辑.如果Spring Data REST API允许为它生成的所有响应添加默认标头,那将是很好的.你的想法是什么?不要说我很懒:)