mirror of https://gitlab.crans.org/nounous/nixos
feat: OAuth Note repairs
parent
55767e5690
commit
baf742483d
|
|
@ -9,6 +9,6 @@ Il faut enregistrer l'extension comme provider
|
||||||
|
|
||||||
```
|
```
|
||||||
$wgOAuthCustomAuthProviders = [
|
$wgOAuthCustomAuthProviders = [
|
||||||
'note' => WSOAuthNoteKfetAuth\NoteKfetAuth::class
|
'note' => WSOAuth\AuthenticationProvider\NoteKfetAuth::class
|
||||||
];
|
];
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AutoloadNamespaces": {
|
"AutoloadNamespaces": {
|
||||||
"WSONoteKfetAuth\\": "src/"
|
"WSOAuth\\AuthenticationProvider\\": "src/"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"NoteKfetUrl": {
|
"NoteKfetUrl": {
|
||||||
|
|
|
||||||
|
|
@ -52,12 +52,12 @@ class NoteKfetAuth extends AuthProvider {
|
||||||
|
|
||||||
$state = random_int(PHP_INT_MIN, PHP_INT_MAX);
|
$state = random_int(PHP_INT_MIN, PHP_INT_MAX);
|
||||||
$secret = "$state";
|
$secret = "$state";
|
||||||
$authUrl = $GLOBALS['wgNoteKfetUrl'] . "o/authorize/?" . http_build_query(
|
$authUrl = $GLOBALS['wgNoteKfetUrl'] . "o/authorize/?" . http_build_query([
|
||||||
'client_id' => $this->clientId,
|
'client_id' => $this->clientId,
|
||||||
'response_type' => 'code',
|
'response_type' => 'code',
|
||||||
'scope' => '1_1',
|
'scope' => '1_1',
|
||||||
'state' => $secret,
|
'state' => $secret,
|
||||||
);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +85,7 @@ class NoteKfetAuth extends AuthProvider {
|
||||||
$userInfos = $this->getUserInfos( $token );
|
$userInfos = $this->getUserInfos( $token );
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => $userInfos->normalized_name,
|
'name' => "note_$userInfos->normalized_name",
|
||||||
'realname' => $userInfos->username,
|
'realname' => $userInfos->username,
|
||||||
'email' => $userInfos->email,
|
'email' => $userInfos->email,
|
||||||
];
|
];
|
||||||
|
|
@ -111,7 +111,7 @@ class NoteKfetAuth extends AuthProvider {
|
||||||
];
|
];
|
||||||
|
|
||||||
$context = stream_context_create($options);
|
$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);
|
$tokens = json_decode($response);
|
||||||
return $tokens->access_token;
|
return $tokens->access_token;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ in
|
||||||
owner = "mediawiki";
|
owner = "mediawiki";
|
||||||
};
|
};
|
||||||
|
|
||||||
age.secrets.mediawiki-openid = {
|
age.secrets.mediawiki-oauth = {
|
||||||
file = ../../../secrets/mediakiwi/mediawiki-openid.age;
|
file = ../../../secrets/mediakiwi/mediawiki-oauth.age;
|
||||||
owner = "mediawiki";
|
owner = "mediawiki";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ in
|
||||||
$LDAPAuthentication2AllowLocalLogin = true;
|
$LDAPAuthentication2AllowLocalLogin = true;
|
||||||
$LDAPProviderDomainConfigs = "${config.age.secrets.mediawiki-ldap.path}";
|
$LDAPProviderDomainConfigs = "${config.age.secrets.mediawiki-ldap.path}";
|
||||||
$wgOAuthCustomAuthProviders = [
|
$wgOAuthCustomAuthProviders = [
|
||||||
'note' => WSOAuthNoteKfetAuth\NoteKfetAuth::class
|
'note' => WSOAuth\AuthenticationProvider\NoteKfetAuth::class
|
||||||
];
|
];
|
||||||
$wgPluggableAuth_Config = [
|
$wgPluggableAuth_Config = [
|
||||||
"Compte Crans" => [
|
"Compte Crans" => [
|
||||||
|
|
@ -267,9 +267,9 @@ in
|
||||||
rev = "REL" + major + "_" + minor;
|
rev = "REL" + major + "_" + minor;
|
||||||
# Le SHA doit être changé à chaque nouveau commit de traduction.
|
# Le SHA doit être changé à chaque nouveau commit de traduction.
|
||||||
# Pas de meilleure solution à ma connaissance pour suivre les releases.
|
# Pas de meilleure solution à ma connaissance pour suivre les releases.
|
||||||
sha256 = "sha256-1jv4nmkxky1dx7833sacsbqww54yb9glrnl1360b13h2z5fhwdxp";
|
sha256 = "sha256-G2C/KuSgfWWftpHHhOABwFcOEb1zB8qmHi9KgrC6Jrc=";
|
||||||
};
|
};
|
||||||
WSONoteKfetAuth = ./WSONoteKfetAuth;
|
WSONoteKfetAuth = "${./WSONoteKfetAuth}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue