You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Filters the User type in the GraphQL Schema to provide fields for querying for user's jwtAuthToken and jwtUserSecret
69
+
* Filters the User type in the GraphQL Schema to provide fields for querying for user's
70
+
* jwtAuthToken and jwtUserSecret
59
71
*
60
72
* @param array $fields The fields for the User type in the GraphQL Schema
61
73
*
@@ -64,9 +76,9 @@ public static function init() {
64
76
publicstaticfunctionadd_user_fields( $fields ) {
65
77
66
78
$fields['jwtAuthToken'] = [
67
-
'type' => Types::string(),
79
+
'type'=> Types::string(),
68
80
'description' => __( 'A JWT token that can be used in future requests for authentication/authorization', 'wp-graphql-jwt-authentication' ),
69
-
'resolve' => function( \WP_User$user ) {
81
+
'resolve'=> function( \WP_User$user ) {
70
82
71
83
/**
72
84
* Get the token for the user
@@ -85,9 +97,9 @@ public static function add_user_fields( $fields ) {
85
97
];
86
98
87
99
$fields['jwtRefreshToken'] = [
88
-
'type' => Types::string(),
100
+
'type'=> Types::string(),
89
101
'description' => __( 'A JWT token that can be used in future requests to get a refreshed jwtAuthToken. If the refresh token used in a request is revoked or otherwise invalid, a valid Auth token will NOT be issued in the response headers.', 'wp-graphql-jwt-authentication' ),
90
-
'resolve' => function( \WP_User$user ) {
102
+
'resolve'=> function( \WP_User$user ) {
91
103
92
104
/**
93
105
* Get the token for the user
@@ -106,9 +118,9 @@ public static function add_user_fields( $fields ) {
106
118
];
107
119
108
120
$fields['jwtUserSecret'] = [
109
-
'type' => Types::string(),
121
+
'type'=> Types::string(),
110
122
'description' => __( 'A unique secret tied to the users JWT token that can be revoked or refreshed. Revoking the secret prevents JWT tokens from being issued to the user. Refreshing the token invalidates previously issued tokens, but allows new tokens to be issued.', 'wp-graphql' ),
111
-
'resolve' => function( \WP_User$user ) {
123
+
'resolve'=> function( \WP_User$user ) {
112
124
113
125
/**
114
126
* Get the user's JWT Secret
@@ -130,53 +142,55 @@ public static function add_user_fields( $fields ) {
130
142
];
131
143
132
144
$fields['jwtAuthExpiration'] = [
133
-
'type' => Types::string(),
145
+
'type'=> Types::string(),
134
146
'description' => __( 'The expiration for the JWT Token for the user. If not set custom for the user, it will use the default sitewide expiration setting', 'wp-graphql-jwt-authentication' ),
'description' => __( 'Whether the JWT User secret has been revoked. If the secret has been revoked, auth tokens will not be issued until an admin, or user with proper capabilities re-issues a secret for the user.', 'wp-graphql-jwt-authentication' ),
'description' => __( 'If true, this will revoke the users JWT secret. If false, this will unrevoke the JWT secret AND issue a new one. To revoke, the user must have proper capabilities to edit users JWT secrets.', 'wp-graphql-jwt-authentication' ),
167
181
];
168
182
169
183
$fields['refreshJwtUserSecret'] = [
170
-
'type' => Types::boolean(),
184
+
'type'=> Types::boolean(),
171
185
'description' => __( 'If true, this will refresh the users JWT secret.' ),
172
186
];
173
187
174
188
return$fields;
175
189
}
176
190
177
191
/**
178
-
* @param int $user_id The ID of the user being mutated
179
-
* @param array $input The input args of the GraphQL mutation request
192
+
* @param int $user_id The ID of the user being mutated
193
+
* @param array $input The input args of the GraphQL mutation request
180
194
* @param string $mutation_name The name of the mutation
0 commit comments