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

Pode on IIS with dual auth #1191

Open
LLIT opened this issue Nov 22, 2023 · 3 comments
Open

Pode on IIS with dual auth #1191

LLIT opened this issue Nov 22, 2023 · 3 comments

Comments

@LLIT
Copy link

LLIT commented Nov 22, 2023

Is it possible to use multiple authentications?

GUI part using Windows Auth, for primary domain.
API part using Basic Auth, Servers is running in a different domain.

All auth is running sessionless, and Windows Auth is running fine for now.

@Badgerati
Copy link
Owner

Hi @LLIT,

Is it that you're using IISAuth within Pode, but you have multiple authentication methods setup against your site in IIS?

@LLIT
Copy link
Author

LLIT commented Nov 24, 2023

IIS is configured to use both Windows and Basic Authentication

# Auth Config
Add-PodeAuthIIS -Name 'WinAuth' -DirectGroups -Sessionless -ScriptBlock {
    param($user)
    $user.add("Role", @("Admin"))
    return @{ User = $user }
}
New-PodeAuthScheme -Basic | Add-PodeAuth -Name 'BasicAuth' -Sessionless -ScriptBlock {
    param($username, $password)
    if ($username -eq 'morty' -and $password -eq 'pickle') {
        return @{...}
    }
    # authentication failed
    return $null
}

@Badgerati
Copy link
Owner

I'd have to test, but what you have looks like it should work 🤔

Have you tried it, and get any errors back = or the routes just throw 401 for any configured to use Basic auth?

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

No branches or pull requests

2 participants