Skip to content

Commit da87b93

Browse files
committed
Store creation time in the token
1 parent 635cfca commit da87b93

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

inc/tokens/class-access-token.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ public function get_client() {
2727
return Client::get_by_id( $this->value['client'] );
2828
}
2929

30+
/**
31+
* Get creation time for the token.
32+
*
33+
* @return int Creation timestamp.
34+
*/
35+
public function get_creation_time() {
36+
return $this->value['created'];
37+
}
38+
3039
/**
3140
* Revoke the token.
3241
*
@@ -116,7 +125,8 @@ public static function create( Client $client, WP_User $user ) {
116125
}
117126

118127
$data = array(
119-
'client' => $client->get_id(),
128+
'client' => $client->get_id(),
129+
'created' => time(),
120130
);
121131
$key = wp_generate_password( static::KEY_LENGTH, false );
122132
$meta_key = static::META_PREFIX . $key;

0 commit comments

Comments
 (0)