Skip to content

Restrict Access to Authenticated Users #58

@akzaidi

Description

@akzaidi

What I'm trying to do

I have a static web app that consists solely of a collection of static html which I am generating using the bookdown package.

I'd like to restrict usage to only those users that I've invited using the Role management blade in the static app's portal page.

I have the following routes.json configuration:

{
    "routes": [
        {
            "route": "/",
            "serve": "/index.html",
            "allowedRoles": [
                "authenticated"
            ]
        },
        {
            "route": "/login",
            "serve": "/.auth/login/github"
        }
    ],
    "platformErrorOverrides": [
        {
            "errorType": "NotFound",
            "serve": "/custom-404.html"
        },
        {
            "errorType": "Unauthenticated",
            "statusCode": "301",
            "serve": "/login"
        }
    ]
}

This seems to work but it 1. allows anyone with a github account to login, not just those that have been invited through the Role management invitations 2. Allows user to bypass login byt directly hitting one of the sub-pages, i.e., <domain-name>/index.html

Questions

  1. How do I ensure only users logged through github and invited through Role Management in the Portal are able to access the site and all the sub-pages?
    • if I use a wildcard for the first route I get an error, i.e.:
    "routes": [
        {
            "route": "/*",
            "serve": "/index.html",
            "allowedRoles": [
                "authenticated"
            ]

error: Encountered an issue while validating routes.json: A route is covered up by a wildcard route and would not be evaluated. Route: /login, Wildcard: /. Please either delete or move the unreachable route.
2. How can I add multiple login values for /login, i.e. I'd like something along the lines of
json "serve": ["/.auth/login/github", "/.auth/login/aad"]
3. Can I add an entire roster of users from a github team or a whole directory of AAD users as invited users, or is the quota of 25 at the user-level?

Sorry for the uninformed questions! I'm quite illiterate with static sites and auth in general 😟

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