Commit Graph

26 Commits

Author SHA1 Message Date
27a6dbeeb6 MDL-67554 oauth2: New filtered language tags for additional parameters.
This adds support for new language tags in OAuth2's
"Additional Parameters Included in a Login Request"
field. Available tags include:

Tags            Example value
-----------------------------
{lang}          fr
{LANG}          FR
{language}      fr_ca
{LANGUAGE}      FR_CA
{lan-guage}     fr-ca
{LAN-GUAGE}     FR-CA
2024-06-23 16:30:07 -04:00
ae63a2d16b MDL-76172 core: Fix error when userinfo is false
This patch should fix a regression introduced in MDL-75171, raised
while running the OBv2.1 certification.
The new method get_raw_userinfo() can return stdClass or false but
the second one was not taken into account from get_userid() (so an
error was thrown: "Argument 1 passed to
core\oauth2\client::map_userinfo_to_fields() must be an instance
of stdClass, bool given").
2022-11-02 12:28:19 +01:00
a6a7b16846 MDL-75171 Auth: extend user logged in event
Co-authored-by: Heena Agheda <heenaagheda@catalyst-au.net>
2022-08-19 18:38:59 +10:00
3daeecd3d2 MDL-73827 lib: Fix URL blocked error for userinfo endpoint
When the oAuth2 issuer hasn't any userinfo endpoint, a call to
$this->get(false) was done, which was returning "The URL is
blocked".
This is a regression from MDL-70649, which added some cURL security
checks.
2022-02-10 10:43:38 +01:00
169e1812ed MDL-65637 core_oauth2: Create new oauth2 mapping function
Separated userinfo mapping into a function and new unit test
2021-06-02 08:11:38 +08:00
5070f0d7ce MDL-70282 oauth: Improve error information
If the request to the OAuth 2 token endpoint fails show the response
body the endpoint returned with its HTTP status (when debug: DEVELOPER).
If no response is available show any error returned by Curl.  Previously
none of this information was available making troubleshooting difficult.

If a token refresh fails in \core\oauth2\refresh_system_tokens_task an
exception is now thrown so that the result is shown as "Fail" on
admin/tasklogs.php?filter=core\oauth2\refresh_system_tokens_task
2021-01-28 10:00:18 +00:00
16d8706e2e MDL-70430 oauth2: Fix storing of the new refresh token
There was a typo - missing underscore. As a result, the new refresh
token was never updated in the database. Depending on the issuer and
whether or when theyu invalidate issued refresh tokens, this might or
might not make the token refresh stop working.
2020-12-08 11:26:23 +01:00
0132037427 MDL-59510 core_oauth2: add autorefresh mode to oauth2\client
Changes:
- The client can now be instantiated with the new mode enabled.
- A user refresh token will be stored if returned as part of the
authorization_code grant but only if the user is authenticated and only
if the mode is enabled.
- If the mode permits it, attempt to exchange a stored refresh token for
a new access token during login checks, allowing access to continue
across sessions without the need to re-grant consent every time.
- Purge all refresh tokens for a given user, issuer and scope on client
log out. This makes sure logout persists across logins.
2020-10-05 09:19:29 +08:00
121fa4381e MDL-64079 oauth2: Set an arbitrary expiration date for eternal tokens
The oauth2 standard does not require access tokens to have an
expiration date. This assumes a default validity period of 7 days unless
an explicit expiration date is communicated by the server.
2018-11-21 10:07:14 +01:00
f11a7d6a05 MDL-63696 oauth2: Store system account access tokens in DB 2018-11-16 11:43:16 +01:00
b323508554 MDL-59512 tool_oauth2: add option for basic authentication 2017-11-17 10:15:29 +01:00
99e632c446 MDL-59889 oauth2: Remove check for storing new refresh token 2017-10-06 14:49:17 +02:00
bd0b987338 MDL-59855 oauth2: Fix PHPDoc type hints 2017-08-26 15:42:04 +02:00
3ba79ff19a MDL-58535 oauth2: Don't rely on the return scopes
MS makes a big mess of returning scopes from oauth requests. They only return the custom MS scopes like
User.Read and they never return non-MS scopes (like openid, profile, email).
2017-05-02 10:03:58 +08:00
8381b05d49 MDL-58535 repository_onedrive: Integration review fixes
Fixes for some missing imports and unused variables.
2017-05-01 16:15:36 +08:00
eb4ab7c4b8 MDL-58489 core: Fix unreachable HTTP error handling 2017-04-07 09:50:15 +02:00
14cfd280d3 MDL-58220 oauth2: Sanity check user pictures 2017-04-03 13:43:27 +08:00
7f15866006 MDL-58220 oauth2: Use email as default username
And give better error messages.
2017-04-03 13:43:27 +08:00
72fd103add MDL-58219 cibot: Fixes
Fixes for cibot warnings.

Part of MDL-58220
2017-04-03 13:41:19 +08:00
299112498b MDL-58090 oauth2: Coding style
Part of MDL-58220
2017-04-03 13:40:13 +08:00
931c023468 MDL-58090 oauth2: Add unit tests
Part of MDL-58220
2017-04-03 13:40:13 +08:00
f9f243f93e MDL-58090 oauth2: Complete phpdocs
Part of MDL-58220
2017-04-03 13:40:13 +08:00
237fd80cd2 MDL-58090 oauth2: API to get a system client
Request an oauth client with an access token retrieved with the stored refresh token from the OAuth issuer.

Part of MDL-58220
2017-04-03 13:39:45 +08:00
485a22fc98 MDL-58090 oauth2: Get rid of behaviour field
OAuth services working fully from config - no more subclasses for each OAuth issuer.

Part of MDL-58220
2017-04-03 13:39:44 +08:00
8445556b4c MDL-58090 oauth2: Move code from subclasses to config
Allow the behaviour of each oauth service to be customised by config instead of
subclasses.

Part of MDL-58220
2017-04-03 13:39:44 +08:00
60237253a2 MDL-58090 oauth2: Store a list of oauth2 services
Build an admin page where OAuth 2 services can be installed and configured.

Part of MDL-58220
2017-04-03 13:39:02 +08:00