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

Add login button to see private repos #205

Open
danielmarschall opened this issue Nov 8, 2023 · 1 comment
Open

Add login button to see private repos #205

danielmarschall opened this issue Nov 8, 2023 · 1 comment

Comments

@danielmarschall
Copy link
Contributor

danielmarschall commented Nov 8, 2023

WebSVN currently supports authentication if HTTP Basic Auth is used.
But this usually means you would have to put the whole WebSVN directory behind a Basic Auth password protection.
In my case, I want to have all projects publish, except a few. The few private projects should be displayed when the user logs in.

I have developed the following solution which I would like to share:

File login.php

<?php
// .htaccess does the magic in re auth!
header('Location:index.php');

File .htaccess

CGIPassAuth On

  <Files login.php>
    AuthType basic
    AuthName "private area"
    AuthUserFile /path/to/.htpasswd
    Require valid-user
  </Files>
  order allow,deny
  deny from all
  satisfy any

Then you need to include a login button somewhere on the page.

Downsides of this solution:

  • Because of the Basic Auth, a logout is technically not possible
  • The path to .htpasswd needs to be included in the .htaccess. Therefore I guess the .htaccess can only be delivered fully commented out. People who want to enable the feature need to edit .htaccess.
  • .htaccess is only possible on Apache, but the configuration "ask for auth only for file login.php" might also be possible on other HTTP daemons.

What do you think?

@michael-o
Copy link
Member

I'll have a look at this in the next couple of days...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants