* @copyright Copyright (c) 2013 University of Lincoln * @license http://mit-license.org/ * @link http://github.com/lncd/oauth2 */ namespace OAuth2\Storage; interface SessionInterface { /** * Create a new session * @param string $clientId The client ID * @param string $ownerType The type of the session owner (e.g. "user") * @param string $ownerId The ID of the session owner (e.g. "123") * @return int The session ID */ public function createSession($clientId, $ownerType, $ownerId); /** * Delete a session * @param string $clientId The client ID * @param string $ownerType The type of the session owner (e.g. "user") * @param string $ownerId The ID of the session owner (e.g. "123") * @return void */ public function deleteSession($clientId, $ownerType, $ownerId); /** * Associate a redirect URI with a session * @param int $sessionId The session ID * @param string $redirectUri The redirect URI * @return void */ public function associateRedirectUri($sessionId, $redirectUri); /** * Associate an access token with a session * @param int $sessionId The session ID * @param string $accessToken The access token * @param int $expireTime Unix timestamp of the access token expiry time * @return void */ public function associateAccessToken($sessionId, $accessToken, $expireTime); /** * Remove an associated access token from a session * @param int $sessionId The session ID * @return void */ public function removeAccessToken($sessionId); /** * Associate a refresh token with a session * @param int $accessTokenId The access token ID * @param string $refreshToken The refresh token * @return void */ public function associateRefreshToken($accessTokenId, $refreshToken); /** * Assocate an authorization code with a session * @param int $sessionId The session ID * @param string $authCode The authorization code * @param int $expireTime Unix timestamp of the access token expiry time * @param string $scopeIds Comma seperated list of scope IDs to be later associated (default = null) * @return void */ public function associateAuthCode($sessionId, $authCode, $expireTime, $scopeIds = null); /** * Remove an associated authorization token from a session * @param int $sessionId The session ID * @return void */ public function removeAuthCode($sessionId); /** * Validate an authorization code * @param string $clientId The client ID * @param string $redirectUri The redirect URI * @param string $authCode The authorization code * @return void */ public function validateAuthCode($clientId, $redirectUri, $authCode); /** * Validate an access token * @param string $accessToken [description] * @return void */ public function validateAccessToken($accessToken); /** * Validate a refresh token * @param string $refreshToken The access token * @return void */ public function validateRefreshToken($refreshToken); /** * Get an access token by ID * @param int $accessTokenId The access token ID * @return array */ public function getAccessToken($accessTokenId); /** * Associate a scope with an access token * @param int $accessTokenId The ID of the access token * @param int $scopeId The ID of the scope * @return void */ public function associateScope($accessTokenId, $scopeId); /** * Get all associated access tokens for an access token * @param string $accessToken The access token * @return array */ public function getScopes($accessToken); }