Skip to content

Add login button to see private repos #205

@danielmarschall

Description

@danielmarschall

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions