2016-10-29 8 views
0

oauth2のアイデアを理解しようとしています。私はこのチュートリアルから学ぶ:私はクラスAuthorizationServerConfigurationからクラスOAuth2SecurityConfigurationSpring oauth2 - 認証サービスとglobalUserDetailsの違い

@Override 
public void configure(ClientDetailsServiceConfigurer clients) throws Exception { 

    clients.inMemory() 
     .withClient("my-trusted-client") 
     .authorizedGrantTypes("password", "authorization_code", "refresh_token", "implicit") 
     .authorities("ROLE_CLIENT", "ROLE_TRUSTED_CLIENT") 
     .scopes("read", "write", "trust") 
     .secret("secret") 
     .accessTokenValiditySeconds(120).//Access token is only valid for 2 minutes. 
     refreshTokenValiditySeconds(600);//Refresh token is only valid for 10 minutes. 
} 

から

@Autowired 
public void globalUserDetails(AuthenticationManagerBuilder auth) throws Exception { 
    auth.inMemoryAuthentication() 
    .withUser("bill").password("abc123").roles("ADMIN").and() 
    .withUser("bob").password("abc123").roles("USER"); 
} 

の主な違いは何であるかを理解するであろう http://websystique.com/spring-security/secure-spring-rest-api-using-oauth2/

私は、最初のケースが私のアプリケーションの単純なユーザーに触れることを理解します。 2番目のケースでは、アプリの認可に触れていますか?資格情報の違いは何ですか:

bill abc123とmy-trusted-client secret?

私は規約を理解することができません。私はそれを説明するのに非常に感謝します;)アプリケーションの私の信頼できるクライアントログインと彼女のユーザーの請求書ログインですか?トークンはアプリケーション用ではなく、ユーザー用に生成されていますか?

ありがとうございます。

答えて

0

OAuth2SecurityConfigurationはWebログインに使用されます。通常、これはデータベースから読み込む必要があります。

AuthorizationServerConfigurationは、oauthクライアントの設定に使用されます。この情報は、基本認証ヘッダーに設定されます。

関連する問題