Skip to content

#26 - remove unused filter that was causing issues with expiration dates #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/ManageTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ public static function init() {
'prevent_token_from_returning_if_revoked'
], 10, 2 );

/**
* Filter the expiration to use the user's expiration if a custom expiration has been set.
*/
add_filter( 'graphql_jwt_auth_expire', [
'\WPGraphQL\JWT_Authentication\ManageTokens',
'use_custom_user_expiration'
] );

add_filter( 'graphql_response_headers_to_send', [
'\WPGraphQL\JWT_Authentication\ManageTokens',
'add_tokens_to_graphql_response_headers'
Expand Down Expand Up @@ -259,30 +251,6 @@ public static function prevent_token_from_returning_if_revoked( $token, $user_id

}


public static function use_custom_user_expiration( $expiration ) {

$user = wp_get_current_user();

/**
* If there is no current user set or the current user's secret has been revoked, return null
*/
if ( 0 === $user->ID || Auth::is_jwt_secret_revoked( $user->ID ) ) {
return null;
}

/**
* If the user has custom expiration configured, use it
*/
$user_expiration = get_user_meta( $user->ID, 'graphql_jwt_custom_expiration', true );
if ( ! empty( $user_expiration ) && is_string( $user_expiration ) ) {
$expiration = $user_expiration;
}

return $expiration;

}

/**
* Returns tokens in the response headers
*
Expand Down