You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-20 12:02:22 +03:00
Lint
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use apalis_core::{
|
use apalis_core::{
|
||||||
builder::{WorkerBuilder, WorkerFactory, WorkerFactoryFn},
|
builder::{WorkerBuilder, WorkerFactoryFn},
|
||||||
context::JobContext,
|
context::JobContext,
|
||||||
executor::TokioExecutor,
|
executor::TokioExecutor,
|
||||||
job::Job,
|
job::Job,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use apalis_core::{
|
use apalis_core::{
|
||||||
builder::{WorkerBuilder, WorkerFactory, WorkerFactoryFn},
|
builder::{WorkerBuilder, WorkerFactoryFn},
|
||||||
context::JobContext,
|
context::JobContext,
|
||||||
executor::TokioExecutor,
|
executor::TokioExecutor,
|
||||||
job::Job,
|
job::Job,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use apalis_core::{
|
use apalis_core::{
|
||||||
builder::{WorkerBuilder, WorkerFactory, WorkerFactoryFn},
|
builder::{WorkerBuilder, WorkerFactoryFn},
|
||||||
context::JobContext,
|
context::JobContext,
|
||||||
executor::TokioExecutor,
|
executor::TokioExecutor,
|
||||||
job::Job,
|
job::Job,
|
||||||
@@ -45,6 +45,7 @@ pub struct HomeserverConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl HomeserverConnection {
|
impl HomeserverConnection {
|
||||||
|
#[must_use]
|
||||||
pub fn new(homeserver: String, endpoint: Url, access_token: String) -> Self {
|
pub fn new(homeserver: String, endpoint: Url, access_token: String) -> Self {
|
||||||
Self {
|
Self {
|
||||||
homeserver,
|
homeserver,
|
||||||
@@ -64,7 +65,7 @@ struct ExternalID {
|
|||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
enum ThreePIDMedium {
|
enum ThreePIDMedium {
|
||||||
Email,
|
Email,
|
||||||
MSISDN,
|
Msisdn,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
@@ -142,14 +143,14 @@ async fn provision_user(
|
|||||||
display_name,
|
display_name,
|
||||||
three_pids,
|
three_pids,
|
||||||
external_ids: vec![ExternalID {
|
external_ids: vec![ExternalID {
|
||||||
auth_provider: "oauth-delegated".to_string(),
|
auth_provider: "oauth-delegated".to_owned(),
|
||||||
external_id: user.sub,
|
external_id: user.sub,
|
||||||
}],
|
}],
|
||||||
};
|
};
|
||||||
|
|
||||||
repo.cancel().await?;
|
repo.cancel().await?;
|
||||||
|
|
||||||
let path = format!("_synapse/admin/v2/users/{user_id}", user_id = mxid,);
|
let path = format!("_synapse/admin/v2/users/{mxid}",);
|
||||||
let mut req = Request::put(matrix.endpoint.join(&path)?.as_str());
|
let mut req = Request::put(matrix.endpoint.join(&path)?.as_str());
|
||||||
req.headers_mut()
|
req.headers_mut()
|
||||||
.context("Failed to get headers")?
|
.context("Failed to get headers")?
|
||||||
@@ -212,7 +213,7 @@ async fn provision_device(
|
|||||||
homeserver = matrix.homeserver
|
homeserver = matrix.homeserver
|
||||||
);
|
);
|
||||||
|
|
||||||
let path = format!("_synapse/admin/v2/users/{user_id}/devices", user_id = mxid);
|
let path = format!("_synapse/admin/v2/users/{mxid}/devices");
|
||||||
let mut req = Request::post(matrix.endpoint.join(&path)?.as_str());
|
let mut req = Request::post(matrix.endpoint.join(&path)?.as_str());
|
||||||
req.headers_mut()
|
req.headers_mut()
|
||||||
.context("Failed to get headers")?
|
.context("Failed to get headers")?
|
||||||
@@ -228,7 +229,7 @@ async fn provision_device(
|
|||||||
|
|
||||||
match response.status() {
|
match response.status() {
|
||||||
StatusCode::CREATED => {
|
StatusCode::CREATED => {
|
||||||
info!(%user.id, %mxid, device.id = job.device_id(), "Device created")
|
info!(%user.id, %mxid, device.id = job.device_id(), "Device created");
|
||||||
}
|
}
|
||||||
code => anyhow::bail!("Failed to provision device. Status code: {code}"),
|
code => anyhow::bail!("Failed to provision device. Status code: {code}"),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"description": "Application configuration root",
|
"description": "Application configuration root",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
"matrix",
|
||||||
"secrets"
|
"secrets"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -120,9 +121,6 @@
|
|||||||
},
|
},
|
||||||
"matrix": {
|
"matrix": {
|
||||||
"description": "Configuration related to the homeserver",
|
"description": "Configuration related to the homeserver",
|
||||||
"default": {
|
|
||||||
"homeserver": "localhost:8008"
|
|
||||||
},
|
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/MatrixConfig"
|
"$ref": "#/definitions/MatrixConfig"
|
||||||
@@ -1118,11 +1116,24 @@
|
|||||||
"MatrixConfig": {
|
"MatrixConfig": {
|
||||||
"description": "Configuration related to the Matrix homeserver",
|
"description": "Configuration related to the Matrix homeserver",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"secret"
|
||||||
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"endpoint": {
|
||||||
|
"description": "The base URL of the homeserver's client API",
|
||||||
|
"default": "http://localhost:8008/",
|
||||||
|
"type": "string",
|
||||||
|
"format": "uri"
|
||||||
|
},
|
||||||
"homeserver": {
|
"homeserver": {
|
||||||
"description": "Time-to-live of a CSRF token in seconds",
|
"description": "Time-to-live of a CSRF token in seconds",
|
||||||
"default": "localhost:8008",
|
"default": "localhost:8008",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"secret": {
|
||||||
|
"description": "Shared secret to use for calls to the admin API",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user