File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,24 @@ protected static function get_meta_prefix() {
15
15
return static ::META_PREFIX ;
16
16
}
17
17
18
+ /**
19
+ * Get the ID for the user that the token represents.
20
+ *
21
+ * @return int
22
+ */
23
+ public function get_user_id () {
24
+ return (int ) $ this ->value ['user ' ];
25
+ }
26
+
27
+ /**
28
+ * Get the user that the token represents.
29
+ *
30
+ * @return WP_User|null
31
+ */
32
+ public function get_user () {
33
+ return get_user_by ( 'id ' , $ this ->get_user_id () );
34
+ }
35
+
18
36
/**
19
37
* Get a token by ID.
20
38
*
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ function bootstrap() {
17
17
load ();
18
18
19
19
/** @todo Implement this :) */
20
- // add_filter( 'determine_current_user', __NAMESPACE__ . '\\attempt_authentication' );
20
+ add_filter ( 'determine_current_user ' , __NAMESPACE__ . '\\Authentication \\ attempt_authentication ' , 11 );
21
21
add_filter ( 'oauth2.grant_types ' , __NAMESPACE__ . '\\register_grant_types ' , 0 );
22
22
add_action ( 'init ' , __NAMESPACE__ . '\\rest_oauth2_load_authorize_page ' );
23
23
add_action ( 'admin_menu ' , array ( __NAMESPACE__ . '\\admin \\Admin ' , 'register ' ) );
@@ -26,6 +26,7 @@ function bootstrap() {
26
26
function load () {
27
27
require __DIR__ . '/inc/class-client.php ' ;
28
28
require __DIR__ . '/inc/class-scopes.php ' ;
29
+ require __DIR__ . '/inc/authentication/namespace.php ' ;
29
30
require __DIR__ . '/inc/endpoints/class-authorization.php ' ;
30
31
require __DIR__ . '/inc/tokens/namespace.php ' ;
31
32
require __DIR__ . '/inc/tokens/class-token.php ' ;
You can’t perform that action at this time.
0 commit comments