Skip to content

Conversation

waldekmastykarz
Copy link
Collaborator

Adds the AuthPlugin. Closes #875

@waldekmastykarz waldekmastykarz requested a review from a team September 11, 2024 15:20
@waldekmastykarz
Copy link
Collaborator Author

Here's a sample config file that you can use for testing:

{
  "$schema": "https://github.com/raw/microsoft/dev-proxy/main/schemas/v0.21.0/rc.schema.json",
  "plugins": [
    {
      "name": "AuthPlugin",
      "enabled": true,
      "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
      "configSection": "authPlugin"
    }
  ],
  "urlsToWatch": [
    "https://jsonplaceholder.typicode.com/*"
  ],
  "authPluginApiKey": {
    "type": "apiKey",
    "apiKey": {
      "in": "header, query",
      "name": "x-api-key",
      "allowedKeys": [
        "1234",
        "abc"
      ]
    }
  },
  "authPlugin": {
    "type": "oauth2",
    "oauth2": {
      "metadataUrl": "https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration",
      "allowedApplications": [
        "0bf30f3b-4a52-48df-9a82-234910c4a086"
      ],
      "allowedAudiences": [
        "5fd6c579-77d2-4ad4-9064-b8b2297a6fb5"
      ],
      "allowedPrincipals": [
        "0a594dfe-5f6c-4029-8c3f-48102e14e4ba"
      ],
      "allowedTenants":[
        "bf805346-44e7-43f7-8e60-c5e24aefe49c"
      ],
      "issuer": "https://login.microsoftonline.com/bf805346-44e7-43f7-8e60-c5e24aefe49c/v2.0",
      "scopes": [
        "Posts.Read"
      ],
      "validateLifetime": false,
      "validateSigningKey": true
    }
  },
  "rate": 50,
  "logLevel": "debug",
  "newVersionNotification": "stable"
}

It contains a sample config for API key auth and OAuth. Switch in the plugin instance which one you want to use and try the different settings. OAuth settings are meant to support any IdP but also the settings that are supported by Easy Auth.

@waldekmastykarz waldekmastykarz merged commit 6844e92 into dotnet:main Sep 13, 2024
4 checks passed
@waldekmastykarz waldekmastykarz deleted the auth-plugin branch September 13, 2024 09:57
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

Successfully merging this pull request may close these issues.

Simulate authentication and authorization
2 participants