This repository was archived by the owner on Sep 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,8 @@ impl OAuth2SessionMutations {
199199 Some ( refresh_token)
200200 } ;
201201
202+ repo. save ( ) . await ?;
203+
202204 Ok ( CreateOAuth2SessionPayload {
203205 session,
204206 access_token : access_token. access_token ,
Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ use axum::http::Request;
1616use hyper:: StatusCode ;
1717use mas_data_model:: { AccessToken , Client , TokenType , User } ;
1818use mas_router:: SimpleRoute ;
19- use mas_storage:: { oauth2:: OAuth2ClientRepository , RepositoryAccess } ;
19+ use mas_storage:: {
20+ oauth2:: { OAuth2AccessTokenRepository , OAuth2ClientRepository } ,
21+ RepositoryAccess ,
22+ } ;
2023use oauth2_types:: {
2124 registration:: ClientRegistrationResponse ,
2225 requests:: AccessTokenResponse ,
@@ -551,4 +554,17 @@ async fn test_oauth2_client_credentials(pool: PgPool) {
551554 assert ! ( response. errors. is_empty( ) , "{:?}" , response. errors) ;
552555 assert ! ( response. data[ "createOauth2Session" ] [ "refreshToken" ] . is_null( ) ) ;
553556 assert ! ( response. data[ "createOauth2Session" ] [ "accessToken" ] . is_string( ) ) ;
557+
558+ let token = response. data [ "createOauth2Session" ] [ "accessToken" ]
559+ . as_str ( )
560+ . unwrap ( ) ;
561+
562+ // We should find this token in the database
563+ let mut repo = state. repository ( ) . await . unwrap ( ) ;
564+ let token = repo
565+ . oauth2_access_token ( )
566+ . find_by_token ( token)
567+ . await
568+ . unwrap ( ) ;
569+ assert ! ( token. is_some( ) ) ;
554570}
You can’t perform that action at this time.
0 commit comments