2016-09-13 11 views
1

私はSpring Oauth2.0をGoogleを認証プロバイダとして使用しています。私は一部のユーザー情報を取得するには、Google APIにアクセスする必要があるが、それは、アクセストークンを必要と私は私のapplication.ymlファイルに次のような構成Spring OAuth2.0:アクセストークンはどこに格納されますか?

security: 
    oauth2: 
    client: 
     clientId: xxxxxxxxxxxxxxxxxxxx 
     clientSecret: xxxxxxxxxxxxxxxxxx 
     accessTokenUri: https://accounts.google.com/o/oauth2/token 
     userAuthorizationUri: https://accounts.google.com/o/oauth2/auth 
     authenticationScheme: query 
     clientAuthenticationScheme: query 
     scope: https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile 
    resource: 
     userInfoUri: https://www.googleapis.com/oauth2/v3/userinfo 
     preferTokenInfo: false 

を持っており、これはこの後

@SpringBootApplication 
@EnableOAuth2Sso 
public class App 
{ 
    public static void main(String[] args) throws Exception { 
     SpringApplication.run(App.class, args);  
    } 

    @Bean public RequestContextListener requestContextListener(){ 
     return new RequestContextListener(); 
    } 

} 

私のメインクラスです。 Springはこのトークンをどこに保存しますか?どのように私はそれを取得できますか?前もって感謝します !!

+0

OAuth2を設定するクラスがあると、メモリまたはデータベース上にあるtokenStoreを定義できます。 –

+0

'TokenStore'を見てくださいhttp://docs.spring.io/spring-security/oauth/apidocs/org/springframework/security/oauth2/provider/token/TokenStore.html –

+0

便利なリンク[アクセストークンの入手方法](http://stackoverflow.com/questions/23759529/android-how-to-get-google-plus-access-token) –

答えて

0

春とソーシャルログインについては、thisのドキュメントを参照してください。レディスにトークンを格納する認証マイクロサービスを置くことができます。私はOutlookでゲートウェイパターンを使用し、oauthサーバーがトークンと要求で指定されたいくつかのデータを取得するクライアント構成にurlを指定する必要があります。

私はそれが役に立ちそうです。

関連する問題