プロジェクト

全般

プロフィール

開発実装 #15

Lunatic1998 さんが約1年前に更新

### 概要 

 


 - 認可エンドポイント 
  - https://docs.aws.amazon.com/ja_jp/cognito/latest/developerguide/authorization-endpoint.html 
 - OpenID Connect (OIDC) 標準における認可エンドポイントの定義 
  - https://openid.net/specs/openid-connect-core-1_0.html#ImplicitAuthorizationEndpoint 

 ### JWT 

 - aws-jwt-verify ライブラリを用いて、ユーザーがアプリに渡すトークンのパラメータを検証する。 
  - JWKS URI には、ユーザーのトークンに署名した秘密鍵に関する公開情報が含まれている。 
  - https://docs.aws.amazon.com/ja_jp/cognito/latest/developerguide/amazon-cognito-user-pools-using-tokens-verifying-a-jwt.html 

 #### `lib/cognito_urls.rb` 

 ``` 
       def init(domain, region) 
         @base_oauth_uri = "https://%s.auth.%s.amazoncognito.com" % [domain, region] 
         @base_idp_uri = "https://cognito-idp.%s.amazonaws.com" % [region] 
       end 
  
       def jwks_uri(pool_id) 
         path = "/%s/.well-known/jwks.json" % [pool_id] 
         URI.join(@base_idp_uri, path).to_s 
       end 
  
       def refresh_token_uri 
         @base_idp_uri 
       end 
  
       def authorize_uri 
         URI.join(@base_oauth_uri, AUTHORIZE_PATH).to_s 
       end 
  
       def token_uri 
         URI.join(@base_oauth_uri, TOKEN_PATH).to_s 
       end 
  
       def login_uri(app_client_id, redirect_uri) 
         path = "%s?response_type=code&client_id=%s&redirect_uri=%s" % 
           [LOGIN_PATH, app_client_id, redirect_uri] 
         URI.join(@base_oauth_uri, path).to_s 
       end 
  
       def signup_uri(app_client_id, redirect_uri) 
         path = "%s?response_type=code&client_id=%s&redirect_uri=%s" % 
           [SIGNUP_PATH, app_client_id, redirect_uri] 
         URI.join(@base_oauth_uri, path).to_s 
       end 
 ```

戻る