AuthPublicShareController
extends PublicShareController
in package
Base controller for interactive public shares
It will verify if the user is properly authenticated to the share. If not the user will be redirected to an authentication page.
Use this for a controller that is to be called directly by a user. So the normal public share page for files/calendars etc.
Tags
Table of Contents
Properties
- $appName : string
- app name
- $request : IRequest
- current request
- $session : ISession
- $urlGenerator : IURLGenerator
- $responders : array<string|int, mixed>
- $token : string
Methods
- __construct() : mixed
- constructor of the controller
- authenticate() : mixed
- Authenticate the share
- buildResponse() : Response
- Serializes and formats a response
- getAuthenticationRedirect() : RedirectResponse
- getResponderByHTTPHeader() : string
- Parses an HTTP accept header and returns the supported responder type
- getToken() : string
- Get the token for this request
- isAuthenticated() : bool
- Check if a share is authenticated or not
- isValidToken() : bool
- Is the provided token a valid token
- setToken() : mixed
- Middleware set the token for the request
- shareNotFound() : mixed
- Function called if the share is not found.
- showAuthenticate() : TemplateResponse
- Show the authentication page The form has to submit to the authenticate method route
- showShare() : TemplateResponse
- Default landing page
- authFailed() : mixed
- Function called after failed authentication
- authSucceeded() : mixed
- Function called after successful authentication
- generatePassword() : void
- Generates a password
- getPasswordHash() : string|null
- Get a hash of the password for this share
- isPasswordProtected() : bool
- Is a share with this token password protected
- registerResponder() : mixed
- Registers a formatter for a type
- showAuthFailed() : TemplateResponse
- The template to show when authentication failed
- showIdentificationResult() : TemplateResponse
- The template to show after user identification
- validateIdentity() : bool
- Validates that the provided identity is allowed to receive a temporary password
- verifyPassword() : bool
- Verify the password
- getRedirect() : RedirectResponse
- getRoute() : string
Properties
$appName
app name
protected
string
$appName
Tags
$request
current request
protected
IRequest
$request
Tags
$session
protected
ISession
$session
$urlGenerator
protected
IURLGenerator
$urlGenerator
$responders
private
array<string|int, mixed>
$responders
Tags
$token
private
string
$token
Methods
__construct()
constructor of the controller
public
__construct(string $appName, IRequest $request, ISession $session, IURLGenerator $urlGenerator) : mixed
Parameters
- $appName : string
-
the name of the app
- $request : IRequest
-
an instance of the request
- $session : ISession
- $urlGenerator : IURLGenerator
Tags
authenticate()
Authenticate the share
public
final authenticate([string $password = '' ][, string $passwordRequest = 'no' ][, string $identityToken = '' ]) : mixed
Parameters
- $password : string = ''
- $passwordRequest : string = 'no'
- $identityToken : string = ''
Tags
Attributes
- #[BruteForceProtection]
- $action: 'publicLinkAuth'
- #[PublicPage]
- #[UseSession]
buildResponse()
Serializes and formats a response
public
buildResponse(mixed $response[, string $format = 'json' ]) : Response
Parameters
- $response : mixed
-
the value that was returned from a controller and is not a Response instance
- $format : string = 'json'
-
the format for which a formatter has been registered
Tags
Return values
ResponsegetAuthenticationRedirect()
public
final getAuthenticationRedirect(string $redirect) : RedirectResponse
Parameters
- $redirect : string
Tags
Return values
RedirectResponsegetResponderByHTTPHeader()
Parses an HTTP accept header and returns the supported responder type
public
getResponderByHTTPHeader(string $acceptHeader[, string $default = 'json' ]) : string
Parameters
- $acceptHeader : string
- $default : string = 'json'
Tags
Return values
string —the responder type
getToken()
Get the token for this request
public
final getToken() : string
Tags
Return values
stringisAuthenticated()
Check if a share is authenticated or not
public
isAuthenticated() : bool
Tags
Return values
boolisValidToken()
Is the provided token a valid token
public
abstract isValidToken() : bool
This function is already called from the middleware directly after setting the token.
Tags
Return values
boolsetToken()
Middleware set the token for the request
public
final setToken(string $token) : mixed
Parameters
- $token : string
Tags
shareNotFound()
Function called if the share is not found.
public
shareNotFound() : mixed
You can use this to do some logging for example
Tags
showAuthenticate()
Show the authentication page The form has to submit to the authenticate method route
public
showAuthenticate() : TemplateResponse
Tags
Attributes
- #[PublicPage]
Return values
TemplateResponseshowShare()
Default landing page
public
abstract showShare() : TemplateResponse
Tags
Return values
TemplateResponseauthFailed()
Function called after failed authentication
protected
authFailed() : mixed
You can use this to do some logging for example
Tags
authSucceeded()
Function called after successful authentication
protected
authSucceeded() : mixed
You can use this to do some logging for example
Tags
generatePassword()
Generates a password
protected
generatePassword() : void
Tags
getPasswordHash()
Get a hash of the password for this share
protected
abstract getPasswordHash() : string|null
To ensure access is blocked when the password to a share is changed we store a hash of the password for this token.
Tags
Return values
string|nullisPasswordProtected()
Is a share with this token password protected
protected
abstract isPasswordProtected() : bool
Tags
Return values
boolregisterResponder()
Registers a formatter for a type
protected
registerResponder(string $format, Closure $responder) : mixed
Parameters
- $format : string
- $responder : Closure
Tags
showAuthFailed()
The template to show when authentication failed
protected
showAuthFailed() : TemplateResponse
Tags
Return values
TemplateResponseshowIdentificationResult()
The template to show after user identification
protected
showIdentificationResult(bool $success) : TemplateResponse
Parameters
- $success : bool
Tags
Return values
TemplateResponsevalidateIdentity()
Validates that the provided identity is allowed to receive a temporary password
protected
validateIdentity([string|null $identityToken = null ]) : bool
Parameters
- $identityToken : string|null = null
Tags
Return values
boolverifyPassword()
Verify the password
protected
verifyPassword(string $password) : bool
Parameters
- $password : string
Tags
Return values
boolgetRedirect()
private
getRedirect() : RedirectResponse
Tags
Return values
RedirectResponsegetRoute()
private
getRoute(string $function) : string
Parameters
- $function : string