@@ -92,33 +92,35 @@ public static function get_rest_uri() {
9292 */
9393 public function register_routes () {
9494 $ args = array (
95- 'methods ' => WP_REST_Server::CREATABLE ,
96- 'callback ' => array ( $ this , 'generate_key_pair ' ),
97- 'args ' => array (
98- 'name ' => array (
95+ 'methods ' => WP_REST_Server::CREATABLE ,
96+ 'callback ' => array ( $ this , 'generate_key_pair ' ),
97+ 'permission_callback ' => '__return_true ' ,
98+ 'args ' => array (
99+ 'name ' => array (
99100 'description ' => esc_html__ ( 'The name of the key-pair. ' , 'jwt-auth ' ),
100101 'type ' => 'string ' ,
101102 'required ' => true ,
102103 'sanitize_callback ' => 'sanitize_text_field ' ,
103104 'validate_callback ' => 'rest_validate_request_arg ' ,
104105 ),
105- 'user_id ' => array (
106+ 'user_id ' => array (
106107 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
107108 'type ' => 'integer ' ,
108109 'required ' => true ,
109110 'sanitize_callback ' => 'absint ' ,
110111 'validate_callback ' => 'rest_validate_request_arg ' ,
111112 ),
112113 ),
113- 'schema ' => array ( $ this , 'get_item_schema ' ),
114+ 'schema ' => array ( $ this , 'get_item_schema ' ),
114115 );
115116 register_rest_route ( self ::_NAMESPACE_ , '/ ' . self ::_REST_BASE_ . '/(?P<user_id>[\d]+) ' , $ args );
116117
117118 $ args = array (
118- 'methods ' => WP_REST_Server::DELETABLE ,
119- 'callback ' => array ( $ this , 'delete_all_key_pairs ' ),
120- 'args ' => array (
121- 'user_id ' => array (
119+ 'methods ' => WP_REST_Server::DELETABLE ,
120+ 'callback ' => array ( $ this , 'delete_all_key_pairs ' ),
121+ 'permission_callback ' => '__return_true ' ,
122+ 'args ' => array (
123+ 'user_id ' => array (
122124 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
123125 'type ' => 'integer ' ,
124126 'required ' => true ,
@@ -130,17 +132,18 @@ public function register_routes() {
130132 register_rest_route ( self ::_NAMESPACE_ , '/ ' . self ::_REST_BASE_ . '/(?P<user_id>[\d]+)/revoke-all ' , $ args );
131133
132134 $ args = array (
133- 'methods ' => WP_REST_Server::DELETABLE ,
134- 'callback ' => array ( $ this , 'delete_key_pair ' ),
135- 'args ' => array (
136- 'user_id ' => array (
135+ 'methods ' => WP_REST_Server::DELETABLE ,
136+ 'callback ' => array ( $ this , 'delete_key_pair ' ),
137+ 'permission_callback ' => '__return_true ' ,
138+ 'args ' => array (
139+ 'user_id ' => array (
137140 'description ' => esc_html__ ( 'The ID of the user. ' , 'jwt-auth ' ),
138141 'type ' => 'integer ' ,
139142 'required ' => true ,
140143 'sanitize_callback ' => 'absint ' ,
141144 'validate_callback ' => 'rest_validate_request_arg ' ,
142145 ),
143- 'api_key ' => array (
146+ 'api_key ' => array (
144147 'description ' => esc_html__ ( 'The API key being revoked. ' , 'jwt-auth ' ),
145148 'type ' => 'string ' ,
146149 'required ' => true ,
0 commit comments