client-api: Add optional cookie field to sso_login*::Response

This commit is contained in:
avdb13 2024-02-23 15:22:49 +01:00 committed by GitHub
parent b8768c3f19
commit abebde0cf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 4 deletions

View File

@ -23,6 +23,7 @@ Improvements:
login types.
- Add deprecated `address` and `medium` 3PID fields for `m.login.password`
login type.
- Add optional cookie field to `session::sso_login*::v3` responses.
# 0.17.4

View File

@ -5,7 +5,7 @@ pub mod v3 {
//!
//! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3loginssoredirect
use http::header::LOCATION;
use http::header::{LOCATION, SET_COOKIE};
use ruma_common::{
api::{request, response, Metadata},
metadata,
@ -37,6 +37,10 @@ pub mod v3 {
/// Redirect URL to the SSO identity provider.
#[ruma_api(header = LOCATION)]
pub location: String,
/// Cookie storing state to secure the SSO process.
#[ruma_api(header = SET_COOKIE)]
pub cookie: Option<String>,
}
impl Request {
@ -49,7 +53,7 @@ pub mod v3 {
impl Response {
/// Creates a new `Response` with the given SSO URL.
pub fn new(location: String) -> Self {
Self { location }
Self { location, cookie: None }
}
}

View File

@ -7,7 +7,7 @@ pub mod v3 {
//!
//! [spec]: https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3loginssoredirectidpid
use http::header::LOCATION;
use http::header::{LOCATION, SET_COOKIE};
use ruma_common::{
api::{request, response, Metadata},
metadata,
@ -43,6 +43,10 @@ pub mod v3 {
/// Redirect URL to the SSO identity provider.
#[ruma_api(header = LOCATION)]
pub location: String,
/// Cookie storing state to secure the SSO process.
#[ruma_api(header = SET_COOKIE)]
pub cookie: Option<String>,
}
impl Request {
@ -55,7 +59,7 @@ pub mod v3 {
impl Response {
/// Creates a new `Response` with the given SSO URL.
pub fn new(location: String) -> Self {
Self { location }
Self { location, cookie: None }
}
}