Checks that we have a valid token linked to a valid resource and that the
user is authorised to access it
Once all checks have been passed, the environment is ready to use
package
|
OCA\Gallery\Middleware
|
Methods
__construct
__construct( $appName, \OCP\IRequest $request, \OCP\IURLGenerator $urlGenerator, \OCP\ILogger $logger)
inherited
Arguments
$urlGenerator
\OCP\IURLGenerator
If a CheckException is being caught, clients who sent an ajax requests
get a JSON error response while the others are redirected to an error
page
afterException( $controller, $methodName, \Exception $exception)
inherited
Authenticate link item with the given password
or with the session if no password was given.
authenticate(\OCP\Share\IShare $share, string $password) : boolean
Throws |
- \OCA\Gallery\Middleware\CheckException
|
Arguments
Response
boolean
true if authorized, an exception is raised otherwise
Checks that we have a valid token linked to a valid resource and that the
user is authorised to access it
beforeController( $controller, $methodName)
Inspects the controller method annotations and if PublicPage is found
it checks that we have a token and an optional password giving access to a valid resource.
Once that's done, the environment is setup so that our services can find the resources they
need.
The checks are not performed on "guest" pages and the environment is not setup. Typical
guest pages are anonymous error ages
Arguments
Checks if a password is required or if the one supplied is working
checkAuthorisation(\OCP\Share\IShare $share, string|null $password)
|
|
Throws |
- \OCA\Gallery\Middleware\CheckException
|
Arguments
$password
string|null
optional password
Makes sure an item type was set for that token
checkItemType(\OCP\Share\IShare $share)
|
|
Throws |
- \OCA\Gallery\Middleware\CheckException
|
Arguments
Validates the given password
checkPassword(\OCP\Share\IShare $share, string $password)
fixme
|
@LukasReschke says: Migrate old hashes to new hash format
Due to the fact that there is no reasonable functionality to update the password
of an existing share no migration is yet performed there.
The only possibility is to update the existing share which will result in a new
share ID and is a major hack.
In the future the migration should be performed once there is a proper method
to update the share's password. (for example $share->updatePassword($password)
|
link
|
https://github.com/owncloud/core/issues/10671
|
|
|
Throws |
- \OCA\Gallery\Middleware\CheckException
|
Arguments
Makes sure the user is already properly authenticated when a password is required and none
was provided
checkSession(\OCP\Share\IShare $share)
|
|
Throws |
- \OCA\Gallery\Middleware\CheckException
|
Arguments
Makes sure that the token contains all the information that we need
checkShareIsValid(\OCP\Share\IShare $share, string $token)
|
|
Throws |
- \OCA\Gallery\Middleware\CheckException
|
Arguments
Decides which type of response to send
computeResponse(string $message, integer $code) : \OCP\AppFramework\Http\JSONResponse|\OCP\AppFramework\Http\RedirectResponse|\OCP\AppFramework\Http\TemplateResponse
inherited
Arguments
Response
\OCP\AppFramework\Http\JSONResponse|\OCP\AppFramework\Http\RedirectResponse|\OCP\AppFramework\Http\TemplateResponse
Validates a token to make sure its linked to a valid resource
getShare(string $token) : \OCP\Share\IShare
Arguments
Response
\OCP\Share\IShare
Redirects the client to an error page
redirectToErrorPage(string $message, integer $code) : \OCP\AppFramework\Http\RedirectResponse
inherited
Arguments
Response
\OCP\AppFramework\Http\RedirectResponse
Shows an authentication form
sendHtml401() : \OCP\AppFramework\Http\TemplateResponse
inherited
Response
\OCP\AppFramework\Http\TemplateResponse
Redirects the client to an error page or shows an authentication form
sendHtmlResponse(string $message, integer $code) : \OCP\AppFramework\Http\RedirectResponse|\OCP\AppFramework\Http\TemplateResponse
inherited
Arguments
Response
\OCP\AppFramework\Http\RedirectResponse|\OCP\AppFramework\Http\TemplateResponse
Returns a JSON response to the client
sendJsonResponse(string $message, integer $code) : \OCP\AppFramework\Http\JSONResponse
inherited
Arguments
Response
\OCP\AppFramework\Http\JSONResponse
Checks that we have a token and an optional password giving access to a
valid resource. Sets the token based environment after that
validateAndSetTokenBasedEnv()
|
|
|
|
Throws |
- \OCA\Gallery\Middleware\CheckException
|
Properties
hasher
hasher : \OCP\Security\IHasher
Type(s)
\OCP\Security\IHasher
session
session : \OCP\ISession
environment
environment : \OCA\Gallery\Environment\Environment
reflector
reflector : \OCP\AppFramework\Utility\IControllerMethodReflector
Type(s)
\OCP\AppFramework\Utility\IControllerMethodReflector
shareManager
shareManager : \OCP\Share\IManager
Type(s)
\OCP\Share\IManager
appName
appName : string
inherited
request
request : \OCP\IRequest
inherited
urlGenerator
urlGenerator : \OCP\IURLGenerator
inherited
Type(s)
\OCP\IURLGenerator
logger
logger : \OCP\ILogger
inherited