Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public share middleware #5986

Closed
2 tasks
rullzer opened this issue Aug 4, 2017 · 1 comment
Closed
2 tasks

Public share middleware #5986

rullzer opened this issue Aug 4, 2017 · 1 comment
Assignees
Labels
1. to develop Accepted and waiting to be taken care of enhancement feature: sharing

Comments

@rullzer
Copy link
Member

rullzer commented Aug 4, 2017

For each app that wants to provide access to some public page the same logic has to be implemented. This is already duplicated in:

  • Normal public page
  • Gallery public page

But will be extended if we would add more things. Like editing with the files_texteditor on public links etc.

Now we should not duplicate this code everywhere. For obvious reasons like:

  • We will mess up somewhere
  • Changes at 1 point are not propagated properly

My brain fart of the evening

  • We add a new (abstract) Controller: PublicShareController
    • function: authenticate($token, $password = '') : TemplateResponse
    • abstract function: authenticationUrl($token) : RedirectResponse
    • abstract function: failedAuthentication() : TemplateResponse
  • We add a new middleware: PublicShareMiddleware
  • We require a route paremeter: token

The middleware will for each PublicShareController check if the the share requires authentication. And if so if that is properly set in the session. If not redirect to authenticationUrl.

If the authentication function returns false we will request a template response. And set the some parameter.

This is just a very rough brain dump. But it should kind of force some structure for PublicSharePage.

What I still need to think about:

  • What if you don't have an authentication page? (the files_texteditor public endpoint?) Just a generic 403 would be enough then I think
  • We could just set the share object when we have it anyway if everything passes?

@LukasReschke as discussed.

@rullzer rullzer added 1. to develop Accepted and waiting to be taken care of enhancement feature: sharing labels Aug 4, 2017
@rullzer rullzer added this to the Nextcloud 13 milestone Aug 4, 2017
@rullzer rullzer removed this from the Nextcloud 14 milestone Jan 10, 2018
@juliusknorr
Copy link
Member

PR #6760

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement feature: sharing
Projects
None yet
Development

No branches or pull requests

5 participants