내 문제는 매우 간단합니다. 내 OAUTH2 인증 서버가 사용자 이름/암호를 받아들이고 토큰을 반환하도록 설정하는 방법을 모르겠습니다.스프링 보안 OAUTH2 사용자 이름/암호로 토큰을 받고
내가 사용하는 경우 :
컬 컬 : 암호 @ localhost를 : 8081/OAuth를/토큰 \ grant_type = client_credentials 이 나에게 토큰을 반환하지만 문제는 사용자가에서 "컬"등록하는 것입니다? 그래서 ... 너무 좋지 않아 DB는 ...
내가 사용하는 경우 :http://www.example.com:8081/oauth/authorize?client_id=web&response_type=token 는 사용자 이름과 암호 대화 메시지를 표시, 나는 "당신이 권한을 부여 함 '웹'내가 그들을 입력하고 그것은 나를 묻는다 티 o 보호 된 자원에 액세스합니까?
scope.read :
내가 그 두 그냥 나에게 토큰을 반환합니다 간단한 요청을 만들 내가 봄 부팅 및 뉴저지에서 편안하고 WS를 사용하여 AngularJS와 프론트 엔드를 위해 그것을 사용하려면 결합 할 수 있습니다 "거부 승인
합니다.사용이 설정 사용해야 -> clients.jdbc (데이터 소스)
어떻게 우리와이 구성표 설정 한 사용자를 단지 기본 로그인에? 이름과 암호.
OauthConfiguration
@Configuration
@EnableAuthorizationServer
public class OAuthConfiguration extends AuthorizationServerConfigurerAdapter
{
@Autowired
private DataSource dataSource;
@Bean
public TokenStore tokenStore()
{
return new JdbcTokenStore(dataSource);
}
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception
{
endpoints.tokenStore(tokenStore());
}
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception
{
// @formatter:off
clients.inMemory()
.withClient("curl")
.authorities("USER")
.resourceIds("reee")
.scopes("read", "write")
.authorizedGrantTypes("client_credentials")
.secret("password")
.and()
.withClient("web")
.redirectUris("http://github.com/techdev-solutions/")
.resourceIds("reee")
.scopes("read")
.authorizedGrantTypes("implicit");
// @formatter:on
}
}
SecurityConfiguration 내가 AQ &를 열어 우리가 비슷한 문제가 있다고 생각
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter
{
@Autowired
private DataSource dataSource;
@Override
protected void configure(HttpSecurity http) throws Exception
{
http.authorizeRequests().antMatchers("/**").authenticated()
.and().httpBasic().realmName("OAuth Server");
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception
{
PasswordEncoder encoder = new BCryptPasswordEncoder();
auth.userDetailsService(userDetailsService()).passwordEncoder(encoder);
auth.jdbcAuthentication().dataSource(dataSource);
}
@Bean
public UserDetailsService userDetailsService()
{
return new CustomUserDetailsService(dataSource);
}
}
DB에 사용자 "컬"이 무엇을 의미합니까 ... " – mariubog
OAUTH_ACCESS_TOKEN 테이블의 새 토큰 client_id가 'curl'이고 user_name이 null입니다. 하지만 '웹'클라이언트를 사용하면 내 사용자 이름 '[email protected]'을 등록하지만 해당 사용자에게 보호 된 리소스에 액세스 할 수있는 권한을 부여하려는 경우 해당 확인 대화 상자가 표시됩니다. 대화 상자를 피하는 방법? – Reeebuuk