From 427ae5070405dd65390075cede1113113ea84bbc Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Mon, 16 Dec 2013 23:47:47 +0000 Subject: [PATCH] First commit of AccessToken --- src/League/OAuth2/Server/AccessToken.php | 118 +++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 src/League/OAuth2/Server/AccessToken.php diff --git a/src/League/OAuth2/Server/AccessToken.php b/src/League/OAuth2/Server/AccessToken.php new file mode 100644 index 00000000..692636a2 --- /dev/null +++ b/src/League/OAuth2/Server/AccessToken.php @@ -0,0 +1,118 @@ +storage = $storage; + $this->scopes = new ParameterBag(); + } + + public function setSession(Session $session) + { + $this->session = $session; + } + + public function getSession() + { + return $this->session; + } + + public function setSessionStorage(SessionStorageInterface $sessionStorage) + { + $this->sessionStorage = $sessionStorage; + } + + public function getSessionStorage() + { + return $this->sessionStorage; + } + + public function setTTL($ttl = 0) + { + $this->ttl = $ttl; + } + + public function getTTL() + { + return $this->ttl; + } + + public function setTimestamp($timestamp = 0) + { + $this->timestamp = $timestamp; + } + + public function getTimestamp() + { + return $this->timestamp; + } + + public function setId($id = null) + { + $this->id = ($id !== null) ? $id : SecureKey::make(); + } + + public function getId() + { + return $this->id; + } + + public function associateScope($scope, $details = []) + { + if (!$this->scopes->has($scope)) { + $this->scopes->set($scope, []); + } + + return $this; + } + + public function hasScope($scope) + { + return $this->scopes->has($scope); + } + + public function getScopes() + { + return $this->scopes->all(); + } +}