Documentation

AuthenticationService
in package
implements AuthenticationServiceInterface

Service used to authenticate users between Office 365 and Drupal.

Interfaces, Classes, Traits and Enums

AuthenticationServiceInterface
The interface for the AuthenticationService.

Table of Contents

$apiConfig  : ImmutableConfig
The modules API config.
$apiSettings  : array<string|int, mixed>
The modules API settings like the client ID.
$authmap  : Authmap
The auth map.
$configFactory  : ConfigFactoryInterface
The config factory interface.
$constants  : ConstantsService
The ConstantsService implementation.
$currentUser  : AccountProxyInterface
The current user account.
$helperService  : HelperService
The o365 helper service.
$loggerService  : O365LoggerServiceInterface
The logger service.
$messenger  : Messenger
The messenger.
$moduleConfig  : ImmutableConfig
The modules base config.
$oauthClient  : GenericProvider
A oauth provider.
$request  : Request
The current request.
$tempStore  : PrivateTempStoreFactory
The private temp store.
$authValues  : array<string|int, mixed>
The auth data.
$debug  : bool
If we want to add debug messages.
__construct()  : mixed
Constructs a new AuthenticationService object.
checkForOfficeLogin()  : string|bool
Check if a user is logged in via Office.
getAccessToken()  : string
Get the access token for the user.
redirectToAuthorizationUrl()  : mixed
Redirect the user to the correct Microsoft pages for oAuth2.
saveAuthDataFromUrl()  : mixed
Save the auth data from the url parameters in the user session storage.
setAccessToken()  : mixed
Generate and save the accessToken.
generateProvider()  : mixed
Generate a basic oAuth2 provider.
getAuthData()  : array<string|int, mixed>
Get the auth data from temp store or cookie.
refreshToken()  : string
Generate a new access token based on the refresh token.
saveAuthData()  : mixed
Save the auth data to the temp store.
saveDataToTempStore()  : mixed
Save data to the tempstore.

Properties

$apiSettings

The modules API settings like the client ID.

protected array<string|int, mixed> $apiSettings

$configFactory

The config factory interface.

protected ConfigFactoryInterface $configFactory

Methods

__construct()

Constructs a new AuthenticationService object.

public __construct(ConfigFactoryInterface $configFactory, PrivateTempStoreFactory $tempStoreFactory, ConstantsService $constantsService, O365LoggerServiceInterface $loggerService, RequestStack $requestStack, HelperService $helperService, AccountProxyInterface $accountProxy, Authmap $authmap, Messenger $messenger) : mixed
Parameters
$configFactory : ConfigFactoryInterface

The config factory interface.

$tempStoreFactory : PrivateTempStoreFactory

The private store factory.

$constantsService : ConstantsService

The constants service from the o365 module.

$loggerService : O365LoggerServiceInterface

The logger service from the o365 module.

$requestStack : RequestStack

The request stack.

$helperService : HelperService

The helper service used to get the api settings.

$accountProxy : AccountProxyInterface

The account proxy for the current user.

$authmap : Authmap

The auth map.

$messenger : Messenger

The messenger class.

Return values
mixed

checkForOfficeLogin()

Check if a user is logged in via Office.

public checkForOfficeLogin() : string|bool
Return values
string|bool

The users ID or FALSE if not logged in via Office.

getAccessToken()

Get the access token for the user.

public getAccessToken([mixed $login = TRUE ]) : string
Parameters
$login : mixed = TRUE

If we want to login the user if there is no token.

Return values
string

The access token.

redirectToAuthorizationUrl()

Redirect the user to the correct Microsoft pages for oAuth2.

public redirectToAuthorizationUrl() : mixed
Return values
mixed

saveAuthDataFromUrl()

Save the auth data from the url parameters in the user session storage.

public saveAuthDataFromUrl() : mixed
Return values
mixed

setAccessToken()

Generate and save the accessToken.

public setAccessToken(mixed $code[, mixed $redirect = FALSE ]) : mixed
Parameters
$code : mixed

The code we got from Microsoft.

$redirect : mixed = FALSE

Either FALSE or an url where to redirect to.

Return values
mixed

generateProvider()

Generate a basic oAuth2 provider.

private generateProvider() : mixed
Return values
mixed

getAuthData()

Get the auth data from temp store or cookie.

private getAuthData() : array<string|int, mixed>
Return values
array<string|int, mixed>

The saved auth data.

refreshToken()

Generate a new access token based on the refresh token.

private refreshToken(string $refreshToken) : string
Parameters
$refreshToken : string

The refresh token.

Tags
throws
TempStoreException
throws
IdentityProviderException
Return values
string

The new access token.

saveAuthData()

Save the auth data to the temp store.

private saveAuthData(AccessTokenInterface $accessToken) : mixed
Parameters
$accessToken : AccessTokenInterface

The access token object.

Tags
throws
TempStoreException
Return values
mixed

saveDataToTempStore()

Save data to the tempstore.

private saveDataToTempStore(string $name, mixed $value) : mixed
Parameters
$name : string

The name of the store.

$value : mixed

The value.

Tags
throws
TempStoreException
Return values
mixed

Search results