Codeberg/pages-server
25
366
Fork
You've already forked pages-server
52

HTTP Auth #163

Closed
opened 2023年01月23日 20:15:40 +01:00 by jimafisk · 13 comments

Is there any way to put some sort of authentication in front of a website? This would be helpful in cases where you have a dev site that shouldn't be public.

Even if you could just specify a username/password for HTTP Auth on a custom domain in something like a .auth file, it would be awesome :).

Would something like that be appropriate for the roadmap? Thanks!

Is there any way to put some sort of authentication in front of a website? This would be helpful in cases where you have a dev site that shouldn't be public. Even if you could just specify a username/password for HTTP Auth on a custom domain in something like a `.auth` file, it would be awesome :). Would something like that be appropriate for the roadmap? Thanks!
Owner
Copy link

I think this should be a wontfix. If you need to serve content for development purpose only, a public webhosting is not the space. Use localhost, or maybe a folder name which is really hard to guess.

For a public hosting, I consider this a feature that adds unnecessary complexity.

I think this should be a wontfix. If you need to serve content for development purpose only, a public webhosting is not the space. Use localhost, or maybe a folder name which is really hard to guess. For a public hosting, I consider this a feature that adds unnecessary complexity.

Totally understand if this is something you don't want included in the project. FWIW there are a few other public hosts that offer access control (figured this would be harder than HTTP Auth):

Totally understand if this is something you don't want included in the project. FWIW there are a few other public hosts that offer access control (figured this would be harder than HTTP Auth): - GitLab Pages: https://docs.gitlab.com/ee/user/project/pages/pages_access_control.html - GitHub Pages: https://docs.github.com/en/enterprise-cloud@latest/pages/getting-started-with-github-pages/changing-the-visibility-of-your-github-pages-site
Owner
Copy link

Please note that the GitHub feature seems to be limited to an "Enterprise Cloud" subscription, and GitLab is basically the best example for feature creep, and I disagree to their philosophy to put so many features in an app that it can barely be hosted by anyone without spinning up a whole datacenter (exaggeration, obviously, but you get the point).

Please note that the GitHub feature seems to be limited to an "Enterprise Cloud" subscription, and GitLab is basically the best example for feature creep, and I disagree to their philosophy to put so many features in an app that it can barely be hosted by anyone without spinning up a whole datacenter (exaggeration, obviously, but you get the point).

I disagree to their philosophy to put so many features in an app that it can barely be hosted by anyone without spinning up a whole datacenter

😂 I agree with you that simplicity of setup and maintainability should have priority over features. Thank you for taking the time to provide feedback, I'll close this out.

> I disagree to their philosophy to put so many features in an app that it can barely be hosted by anyone without spinning up a whole datacenter 😂 I agree with you that simplicity of setup and maintainability should have priority over features. Thank you for taking the time to provide feedback, I'll close this out.

I think this would be a quite nice addition. Saying that "gitlab and github have too many features anyhow" is kinda weird. They are the benchmark for a lot of the things that codeberg / forgejo aim to provide, are they not? Especially in order to get expensive github premium features for cheap might be a reason for a lot of people to use forgejo in the first place. Like it or not. Hopefully some of these people eventually also contribute, but you never know and that is the thrill of open source, is it not? So I would say this feature request is very valid and it would be nice to have it implemented.

FWIW: I have been jumping hoops today to find a solution to get a website with some documentation containing mildly sensitive data behind a user login without paying for it (it is about some stuff for the Kindergarten of my child). I ended up with gitlab pages, but as far as I can tell that will only scale to 5 users before I have to pay.

I think this would be a quite nice addition. Saying that "gitlab and github have too many features anyhow" is kinda weird. They are the benchmark for a lot of the things that codeberg / forgejo aim to provide, are they not? Especially in order to get expensive github premium features for cheap might be a reason for a lot of people to use forgejo in the first place. Like it or not. Hopefully some of these people eventually also contribute, but you never know and that is the thrill of open source, is it not? So I would say this feature request is very valid and it would be nice to have it implemented. FWIW: I have been jumping hoops today to find a solution to get a website with some documentation containing mildly sensitive data behind a user login without paying for it (it is about some stuff for the Kindergarten of my child). I ended up with gitlab pages, but as far as I can tell that will only scale to 5 users before I have to pay.

Hi @levino,

I had this feature working previously for my own instance, here's the code in case you're interested: #166

My understanding is the project maintainers do not want to include the feature, but you should be able to pull it in if you want to run your own build. Hope that helps!

Hi @levino, I had this feature working previously for my own instance, here's the code in case you're interested: https://codeberg.org/Codeberg/pages-server/pulls/166 My understanding is the project maintainers do not want to include the feature, but you should be able to pull it in if you want to run your own build. Hope that helps!
Owner
Copy link

It is simply not what Codeberg Pages is about. Our service is about "hosting Free/Libre software for the public". We only allow private repos for convenience, it's not that we want to offer free cloud hosting for everyone and everything.

Adding a restriction on a website only makes sense when the actual content is not already visible to the world. So it would encourage more private repositories, which is defeating the legal purpose of our non-profit association.

It is simply not what Codeberg Pages is about. Our service is about "hosting Free/Libre software for the public". We only allow private repos for convenience, it's not that we want to offer free cloud hosting for everyone and everything. Adding a restriction on a website only makes sense when the actual content is not already visible to the world. So it would encourage more private repositories, which is defeating the legal purpose of our non-profit association.

We could still add it to the pages-server and disable it for Codeberg Pages

We could still add it to the pages-server and disable it for Codeberg Pages

Thank you @jimafisk. However I would expect that user authentication is based on the users from my codeberg instance. So all users who have read access to the repository with the websites source also have access to the website. That is how gitlab does it. Maintaining some kind of list with username and password does not scale (the least of the problem will be the people forgetting their passwords...).

Thank you @jimafisk. However I would expect that user authentication is based on the users from my codeberg instance. So all users who have read access to the repository with the websites source also have access to the website. That is how gitlab does it. Maintaining some kind of list with username and password does not scale (the least of the problem will be the people forgetting their passwords...).

@levino How about adding OAuth and using the accounts with access to the repo that hosts the files?

@levino How about adding OAuth and using the accounts with access to the repo that hosts the files?

That would be nice. I asked about this for authjs for github organizations. The idea should be the same for forgejo. However I doubt that jwts issued via the OAuth process will include the information that a user has access to a specific repository and if, which access they have. Maybe there is some kind of endpoint in the forgejo instance that I could query for a given jwt but that is definitely not possible with github so I would be surprised if it is implemented in forgejo. Could also potentially be abused, idk.

That would be nice. I [asked](https://github.com/nextauthjs/next-auth/discussions/9270) about this for `authjs` for github organizations. The idea should be the same for forgejo. However I doubt that jwts issued via the OAuth process will include the information that a user has access to a specific repository and if, which access they have. Maybe there is some kind of endpoint in the forgejo instance that I could query for a given jwt but that is definitely not possible with github so I would be surprised if it is implemented in forgejo. Could also potentially be abused, idk.

Any new on this feature? I also have a use case for having finer access control.
Probably something that mirrors Gitea's read rights on a repo.

Any new on this feature? I also have a use case for having finer access control. Probably something that mirrors Gitea's read rights on a repo.

I built my own solution from some parts that I found on the internet (mainly docker, coolify and pocketbase). Feel free to adapt https://github.com/levino/protected-docs-example or https://github.com/levino/protected-docs-template to your needs. If you have any questions, let me know in the repos.

FWIW: I really like the fact that I can provide access to people who do not have GitHub/Gitea/Codeberg/Forgejo-Accounts. Surprisingly many people are mentally incapable of creating an account with GitHub.

I built my own solution from some parts that I found on the internet (mainly docker, coolify and pocketbase). Feel free to adapt https://github.com/levino/protected-docs-example or https://github.com/levino/protected-docs-template to your needs. If you have any questions, let me know in the repos. FWIW: I really like the fact that I can provide access to people who do not have GitHub/Gitea/Codeberg/Forgejo-Accounts. Surprisingly many people are mentally incapable of creating an account with GitHub.
Sign in to join this conversation.
No Branch/Tag specified
main
renovate/woodpeckerci-plugin-docker-buildx-6.x
renovate/golang-deps-non-major
git-pages-server-doc
pages
ci_user-local-acme-service
feat/redis-caching
fix/memory-problem
v6.4
v6.3
v6.2.1
v6.2
v6.1
v6.0
v5.1
v5.0
v4.6.3
v4.6.2
v4.6.1
v4.6
v4.5
v4.4
v4.3
v4.2
v4.1
v4.0
v3.2.1
v3.2
v0.3.1
v0.3.0
v0.2.2
v0.2.1
v3.1
v3.0a
v3.0
v2.5b
v2.5a
v2.5
v2.4
v2.3
v2.2
v2.1
v2.0
v1.0_php
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Codeberg/pages-server#163
Reference in a new issue
Codeberg/pages-server
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?