Google Shared Contacts Manager  1.0
Semestral project for BI-ZNF
OAuthService Class Reference

Class handles process of creation a Google Client, authenticates user and handles access token operations. More...

Inheritance diagram for OAuthService:

Public Member Functions

 __construct (Session $session)
 OAuthService constructor. More...
 
 getGoogleLink ()
 Get Google Authentication link that user will be redirected to once he click Login button. More...
 
 handleGoogleResponse ($authCode)
 Receive Google Access Token based on authentication code. More...
 
 getAccessToken ()
 Get currently stored access token. More...
 
 isAuthenticated ()
 Determine whether app still has a valid access token. More...
 
 getClient ()
 Get Google Client Object. More...
 

Data Fields

const CLIENT_SECRET_PATH = __DIR__."/../config/google-client-secret.json"
 
const SESSION_SECTION = "oauth2-google"
 
const ERROR_NO_DOMAIN = 1
 
const ERROR_NOT_ADMIN = 2
 

Private Member Functions

 setupClient ()
 Method prepares Google Client and sets the callback URL. More...
 

Private Attributes

 $client = null
 
 $sessionSection
 
 $scopes
 

Detailed Description

Class handles process of creation a Google Client, authenticates user and handles access token operations.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Session  $session)

OAuthService constructor.

Parameters
Session$session

Member Function Documentation

◆ getAccessToken()

getAccessToken ( )

Get currently stored access token.

Returns
string

◆ getClient()

getClient ( )

Get Google Client Object.

Returns

◆ getGoogleLink()

getGoogleLink ( )

Get Google Authentication link that user will be redirected to once he click Login button.

Returns
string

◆ handleGoogleResponse()

handleGoogleResponse (   $authCode)

Receive Google Access Token based on authentication code.

Parameters
string$authCode

◆ isAuthenticated()

isAuthenticated ( )

Determine whether app still has a valid access token.

Returns
bool

◆ setupClient()

setupClient ( )
private

Method prepares Google Client and sets the callback URL.

Field Documentation

◆ $client

$client = null
private

◆ $scopes

$scopes
private
Initial value:
= [
"http://www.google.com/m8/feeds/contacts/",
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/admin.directory.user.readonly"
]

◆ $sessionSection

$sessionSection
private

◆ CLIENT_SECRET_PATH

const CLIENT_SECRET_PATH = __DIR__."/../config/google-client-secret.json"

◆ ERROR_NO_DOMAIN

const ERROR_NO_DOMAIN = 1

◆ ERROR_NOT_ADMIN

const ERROR_NOT_ADMIN = 2

◆ SESSION_SECTION

const SESSION_SECTION = "oauth2-google"

The documentation for this class was generated from the following file: