1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

data-model: simplify the authorization grants and sessions

This commit is contained in:
Quentin Gliech
2022-12-07 15:08:04 +01:00
parent 92d6f5b087
commit 12ce2a3d04
18 changed files with 92 additions and 233 deletions

View File

@ -13,7 +13,7 @@
// limitations under the License.
use async_graphql::{Context, Description, Object, ID};
use mas_storage::{oauth2::client::lookup_client, PostgresqlBackend};
use mas_storage::oauth2::client::lookup_client;
use oauth2_types::scope::Scope;
use sqlx::PgPool;
use ulid::Ulid;
@ -24,13 +24,13 @@ use super::{BrowserSession, NodeType, User};
/// An OAuth 2.0 session represents a client session which used the OAuth APIs
/// to login.
#[derive(Description)]
pub struct OAuth2Session(pub mas_data_model::Session<PostgresqlBackend>);
pub struct OAuth2Session(pub mas_data_model::Session);
#[Object(use_type_description)]
impl OAuth2Session {
/// ID of the object.
pub async fn id(&self) -> ID {
NodeType::OAuth2Session.id(self.0.data)
NodeType::OAuth2Session.id(self.0.id)
}
/// OAuth 2.0 client used by this session.

View File

@ -242,7 +242,7 @@ impl User {
let mut connection = Connection::new(has_previous_page, has_next_page);
connection.edges.extend(edges.into_iter().map(|s| {
Edge::new(
OpaqueCursor(NodeCursor(NodeType::OAuth2Session, s.data)),
OpaqueCursor(NodeCursor(NodeType::OAuth2Session, s.id)),
OAuth2Session(s),
)
}));