feat: OAuth Note repairs

wiki
Pyjacpp 2026-03-23 23:48:34 +01:00
parent 55767e5690
commit baf742483d
No known key found for this signature in database
GPG Key ID: ED479A5A26930939
4 changed files with 11 additions and 11 deletions

View File

@ -9,6 +9,6 @@ Il faut enregistrer l'extension comme provider
```
$wgOAuthCustomAuthProviders = [
'note' => WSOAuthNoteKfetAuth\NoteKfetAuth::class
'note' => WSOAuth\AuthenticationProvider\NoteKfetAuth::class
];
```

View File

@ -13,7 +13,7 @@
}
},
"AutoloadNamespaces": {
"WSONoteKfetAuth\\": "src/"
"WSOAuth\\AuthenticationProvider\\": "src/"
},
"config": {
"NoteKfetUrl": {

View File

@ -52,12 +52,12 @@ class NoteKfetAuth extends AuthProvider {
$state = random_int(PHP_INT_MIN, PHP_INT_MAX);
$secret = "$state";
$authUrl = $GLOBALS['wgNoteKfetUrl'] . "o/authorize/?" . http_build_query(
$authUrl = $GLOBALS['wgNoteKfetUrl'] . "o/authorize/?" . http_build_query([
'client_id' => $this->clientId,
'response_type' => 'code',
'scope' => '1_1',
'state' => $secret,
);
]);
return true;
}
@ -85,7 +85,7 @@ class NoteKfetAuth extends AuthProvider {
$userInfos = $this->getUserInfos( $token );
return [
'name' => $userInfos->normalized_name,
'name' => "note_$userInfos->normalized_name",
'realname' => $userInfos->username,
'email' => $userInfos->email,
];
@ -111,7 +111,7 @@ class NoteKfetAuth extends AuthProvider {
];
$context = stream_context_create($options);
$response = file_get_contents($GLOBALS['wgNoteKfetUrl'] . 'o/oauth/token/', false, $context);
$response = file_get_contents($GLOBALS['wgNoteKfetUrl'] . 'o/token/', false, $context);
$tokens = json_decode($response);
return $tokens->access_token;
}

View File

@ -16,8 +16,8 @@ in
owner = "mediawiki";
};
age.secrets.mediawiki-openid = {
file = ../../../secrets/mediakiwi/mediawiki-openid.age;
age.secrets.mediawiki-oauth = {
file = ../../../secrets/mediakiwi/mediawiki-oauth.age;
owner = "mediawiki";
};
@ -107,7 +107,7 @@ in
$LDAPAuthentication2AllowLocalLogin = true;
$LDAPProviderDomainConfigs = "${config.age.secrets.mediawiki-ldap.path}";
$wgOAuthCustomAuthProviders = [
'note' => WSOAuthNoteKfetAuth\NoteKfetAuth::class
'note' => WSOAuth\AuthenticationProvider\NoteKfetAuth::class
];
$wgPluggableAuth_Config = [
"Compte Crans" => [
@ -267,9 +267,9 @@ in
rev = "REL" + major + "_" + minor;
# Le SHA doit être changé à chaque nouveau commit de traduction.
# Pas de meilleure solution à ma connaissance pour suivre les releases.
sha256 = "sha256-1jv4nmkxky1dx7833sacsbqww54yb9glrnl1360b13h2z5fhwdxp";
sha256 = "sha256-G2C/KuSgfWWftpHHhOABwFcOEb1zB8qmHi9KgrC6Jrc=";
};
WSONoteKfetAuth = ./WSONoteKfetAuth;
WSONoteKfetAuth = "${./WSONoteKfetAuth}";
};
};
}