1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-31 09:24:31 +03:00

graphql: Expose the BrowserSession User-Agent

This commit is contained in:
Quentin Gliech
2023-08-29 16:50:44 +02:00
parent 5d3b8cd92f
commit a19f405e53
4 changed files with 19 additions and 0 deletions

View File

@ -87,6 +87,11 @@ impl BrowserSession {
BrowserSessionState::Active BrowserSessionState::Active
} }
} }
/// The user-agent string with which the session was created.
pub async fn user_agent(&self) -> Option<&str> {
self.0.user_agent.as_deref()
}
} }
/// An authentication records when a user enter their credential in a browser /// An authentication records when a user enter their credential in a browser

View File

@ -95,6 +95,10 @@ type BrowserSession implements Node & CreationEvent {
The state of the session. The state of the session.
""" """
state: BrowserSessionState! state: BrowserSessionState!
"""
The user-agent string with which the session was created.
"""
userAgent: String
} }
type BrowserSessionConnection { type BrowserSessionConnection {

View File

@ -100,6 +100,8 @@ export type BrowserSession = CreationEvent &
state: BrowserSessionState; state: BrowserSessionState;
/** The user logged in this session. */ /** The user logged in this session. */
user: User; user: User;
/** The user-agent string with which the session was created. */
userAgent?: Maybe<Scalars["String"]["output"]>;
}; };
export type BrowserSessionConnection = { export type BrowserSessionConnection = {

View File

@ -172,6 +172,14 @@ export default {
}, },
args: [], args: [],
}, },
{
name: "userAgent",
type: {
kind: "SCALAR",
name: "Any",
},
args: [],
},
], ],
interfaces: [ interfaces: [
{ {