Skip to content

Instantly share code, notes, and snippets.

@morrislaptop
Created May 15, 2018 15:01
Show Gist options
  • Save morrislaptop/9780908aab5607f074002a4da5a58d24 to your computer and use it in GitHub Desktop.
Save morrislaptop/9780908aab5607f074002a4da5a58d24 to your computer and use it in GitHub Desktop.
<?php
namespace App\Firebase;
use Illuminate\Contracts\Auth\Authenticatable;
class User implements Authenticatable
{
/**
* The claims decoded from the JWT token.
*
* @var array
*/
private $claims;
/**
* Creates a new authenticatable user from Firebase.
*/
public function __construct($claims)
{
$this->claims = $claims;
}
/**
* Get the name of the unique identifier for the user.
*
* @return string
*/
public function getAuthIdentifierName()
{
return 'sub';
}
/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthIdentifier()
{
return (string) $this->claims['sub'];
}
/**
* Get the password for the user.
*
* @return string
*/
public function getAuthPassword()
{
throw new \Exception('No password for Firebase User');
}
/**
* Get the token value for the "remember me" session.
*
* @return string
*/
public function getRememberToken()
{
throw new \Exception('No remember token for Firebase User');
}
/**
* Set the token value for the "remember me" session.
*
* @param string $value
*
* @return void
*/
public function setRememberToken($value)
{
throw new \Exception('No remember token for Firebase User');
}
/**
* Get the column name for the "remember me" token.
*
* @return string
*/
public function getRememberTokenName()
{
throw new \Exception('No remember token for Firebase User');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment