All Projects → Soluto → oidc-server-mock

Soluto / oidc-server-mock

Licence: Apache-2.0 License
Configurable Mock Server for OpenId Connect

Programming Languages

C#
18002 projects
typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to oidc-server-mock

lemonldap-ng
LemonLDAP::NG main code
Stars: ✭ 49 (-49.48%)
Mutual labels:  openid-connect, openid-provider, openid-server
Node Oidc Provider
OpenID Certified™ OAuth 2.0 Authorization Server implementation for Node.js
Stars: ✭ 2,018 (+1980.41%)
Mutual labels:  openid-connect, openid-provider
konnect
Kopano Konnect implements an OpenID provider (OP) with integrated web login and consent forms.
Stars: ✭ 54 (-44.33%)
Mutual labels:  openid-connect, openid-provider
Hydra
OpenID Certified™ OpenID Connect and OAuth Provider written in Go - cloud native, security-first, open source API security for your infrastructure. SDKs for any language. Compatible with MITREid.
Stars: ✭ 11,884 (+12151.55%)
Mutual labels:  openid-connect, openid-provider
mock-oauth2-server
A scriptable/customizable web server for testing HTTP clients using OAuth2/OpenID Connect or applications with a dependency to a running OAuth2 server (i.e. APIs requiring signed JWTs from a known issuer)
Stars: ✭ 83 (-14.43%)
Mutual labels:  openid-connect
Angular4-OidcClientJs-Example
Code from scottbrady91.com/Angular
Stars: ✭ 72 (-25.77%)
Mutual labels:  openid-connect
run-aspnet-identityserver4
Secure microservices with using standalone Identity Server 4 and backing with Ocelot API Gateway. Protect our ASP.NET Web MVC and API applications with using OAuth 2 and OpenID Connect in IdentityServer4. Securing your web application and API with tokens, working with claims, authentication and authorization middlewares and applying policies.
Stars: ✭ 159 (+63.92%)
Mutual labels:  openid-connect
steam-openid-connect-provider
Steam OpenID Connect Identity Provider (IdP)
Stars: ✭ 40 (-58.76%)
Mutual labels:  openid-connect
keyonic-v2
A Keycloak Mobile Implementation using Angular v4 and Ionic v3
Stars: ✭ 23 (-76.29%)
Mutual labels:  openid-connect
haskell-oidc-client
OpenID Connect 1.0 client (RP) library for Haskell
Stars: ✭ 23 (-76.29%)
Mutual labels:  openid-connect
s3-proxy
S3 Reverse Proxy with GET, PUT and DELETE methods and authentication (OpenID Connect and Basic Auth)
Stars: ✭ 106 (+9.28%)
Mutual labels:  openid-connect
uPortal-web-components
A collection of uPortal Web Components and JavaScript utilities
Stars: ✭ 24 (-75.26%)
Mutual labels:  openid-connect
secure-oauth2-oidc-workshop
Hands-On Workshop for OAuth 2.0 and OpenID Connect 1.0
Stars: ✭ 58 (-40.21%)
Mutual labels:  openid-connect
okta-angular-openid-connect-example
Angular + Angular CLI with Authentication from OpenID Connect and Okta
Stars: ✭ 19 (-80.41%)
Mutual labels:  openid-connect
GoogleSignIn-iOS
Enables iOS and macOS apps to sign in with Google.
Stars: ✭ 198 (+104.12%)
Mutual labels:  openid-connect
doorkeeper-openid connect
OpenID Connect extension for Doorkeeper
Stars: ✭ 152 (+56.7%)
Mutual labels:  openid-provider
oxd
Client software to secure apps with OAuth 2.0, OpenID Connect, and UMA
Stars: ✭ 40 (-58.76%)
Mutual labels:  openid-connect
oidc-filter
A WASM plugin for Envoy supporting the Open ID Connect Authorization Flow, extending Istio's JWT functionality
Stars: ✭ 40 (-58.76%)
Mutual labels:  openid-connect
aws-cdk-github-oidc
CDK constructs to use OpenID Connect for authenticating your Github Action workflow with AWS IAM
Stars: ✭ 59 (-39.18%)
Mutual labels:  openid-connect
yii-auth-client
Yii Framework external authentication via OAuth and OpenID Extension
Stars: ✭ 20 (-79.38%)
Mutual labels:  openid-connect

OpenId Connect Server Mock

Run Tests badge

This project allows you to run configurable mock server with OpenId Connect functionality.

The image is stored in github registry. Use the following to pull the image:

docker pull ghcr.io/soluto/oidc-server-mock:latest

This is the sample of using the server in docker-compose configuration:

  version: '3'
  services:
    oidc-server-mock:
      container_name: oidc-server-mock
      image: ghcr.io/soluto/oidc-server-mock:latest
      ports:
        - "4011:80"
      environment:
        ASPNETCORE_ENVIRONMENT: Development
        SERVER_OPTIONS_INLINE: |
          {
            "AccessTokenJwtType": "JWT",
            "Discovery": {
              "ShowKeySet": true
            },
            "Authentication": {
              "CookieSameSiteMode": "Lax",
              "CheckSessionCookieSameSiteMode": "Lax"
            }
          }
        ACCOUNT_OPTIONS_INLINE: |
          {
            "AutomaticRedirectAfterSignOut": true
          }
        API_SCOPES_INLINE: |
          [
            {
              "Name": "some-app-scope-1"
            },
            {
              "Name": "some-app-scope-2"
            }
          ]
        API_RESOURCES_INLINE: |
          [
            {
              "Name": "some-app",
              "Scopes": ["some-app-scope-1", "some-app-scope-2"]
            }
          ]
        USERS_CONFIGURATION_INLINE: |
          [
            {
              "SubjectId":"1",
              "Username":"User1",
              "Password":"pwd",
              "Claims": [
                {
                  "Type": "name",
                  "Value": "Sam Tailor"
                },
                {
                  "Type": "email",
                  "Value": "[email protected]"
                },
                {
                  "Type": "some-api-resource-claim",
                  "Value": "Sam's Api Resource Custom Claim"
                },
                {
                  "Type": "some-api-scope-claim",
                  "Value": "Sam's Api Scope Custom Claim"
                },
                {
                  "Type": "some-identity-resource-claim",
                  "Value": "Sam's Identity Resource Custom Claim"
                }
              ]
            }
          ]
        CLIENTS_CONFIGURATION_PATH: /tmp/config/clients-config.json
      volumes:
        - .:/tmp/config:ro

When clients-config.json is as following:

[{
        "ClientId": "implicit-mock-client",
        "Description": "Client for implicit flow",
        "AllowedGrantTypes": [
            "implicit"
        ],
        "AllowAccessTokensViaBrowser": true,
        "RedirectUris": [
            "http://localhost:3000/auth/oidc",
            "http://localhost:4004/auth/oidc"
        ],
        "AllowedScopes": [
            "openid",
            "profile",
            "email"
        ],
        "IdentityTokenLifetime": 3600,
        "AccessTokenLifetime": 3600
    },
    {
        "ClientId": "client-credentials-mock-client",
        "ClientSecrets": [
          "client-credentials-mock-client-secret"
        ],
        "Description": "Client for client credentials flow",
        "AllowedGrantTypes": [
            "client_credentials"
        ],
        "AllowedScopes": [
            "some-app"
        ],
        "ClientClaimsPrefix": "",
        "Claims": [
            {
                "Type": "string_claim",
                "Value": "string_claim_value"
            },
            {
                "Type": "json_claim",
                "Value": "['value1', 'value2']",
                "ValueType": "json"
            }
        ]

    }
]

Clients configuration should be provided. Test user configuration is optional (used for implicit flow only).

There are two ways to provide configuration for supported scopes, clients and users. You can either provide it inline as environment variable:

  • SERVER_OPTIONS_INLINE

  • ACCOUNT_OPTIONS_INLINE

  • API_SCOPES_INLINE

  • USERS_CONFIGURATION_INLINE

  • CLIENTS_CONFIGURATION_INLINE

  • API_RESOURCES_INLINE

  • IDENTITY_RESOURCES_INLINE

    or mount volume and provide the path to configuration json as environment variable:

  • SERVER_OPTIONS_PATH

  • ACCOUNT_OPTIONS_PATH

  • API_SCOPES_PATH

  • USERS_CONFIGURATION_PATH

  • CLIENTS_CONFIGURATION_PATH

  • API_RESOURCES_PATH

  • IDENTITY_RESOURCES_PATH

Base path

The server can be configured to run with base path. So all the server endpoints will be also available with some prefix segment. For example http://localhost:8080/my-base-path/.well-known/openid-configuration and http://localhost:8080/my-base-path/connect/token. Just set BasePath property in ASPNET_SERVICES_OPTIONS_INLINE/PATH env var.

Custom endpoints

User management

Users can be added (in future also removed and altered) via user management endpoint.

  • Create new user: POST request to /api/v1/user path. The request body should be the User object. Just as in USERS_CONFIGURATION. The response is subjectId as sent in request.

  • Get user: GET request to /api/v1/user/{subjectId} path. The response is User object

  • Update user PUT request to /api/v1/user path. (Not implemented yet) The request body should be the User object. Just as in USERS_CONFIGURATION. The response is subjectId as sent in request.

    If user doesn't exits it will be created.

  • Delete user: DELETE request to /api/v1/user/{subjectId} path. (Not implemented yet) The response is User object

HTTPS

To use https protocol with the server just add the following environment variables to the docker run/docker-compose up command, expose ports and mount volume containing the pfx file:

environment:
  ASPNETCORE_URLS: https://+:443;http://+:80
  ASPNETCORE_Kestrel__Certificates__Default__Password: <password for pfx file>
  ASPNETCORE_Kestrel__Certificates__Default__Path: /path/to/pfx/file
volumes:
  - ./local/path/to/pfx/file:/path/to/pfx/file:ro
ports:
  - 8080:80
  - 8443:443

Cookie SameSite mode

Since Aug 2020 Chrome has a new secure-by-default model for cookies, enabled by a new cookie classification system. Other browsers will join in near future.

There are two ways to use oidc-server-mock with this change.

  1. Run the container with HTTPS enabled (see above).
  2. Change cookies SameSite mode from default None to Lax. To do so just add the following to SERVER_OPTIONS_INLINE (or the file at SERVER_OPTIONS_PATH):
{
  // Existing configuration
  // ...
  "Authentication": {
    "CookieSameSiteMode": "Lax",
    "CheckSessionCookieSameSiteMode": "Lax"
  }
}

Contributing

Requirements

  1. Docker (version 18.09 or higher)

  2. NodeJS (version 10.0.0 or higher)

Getting started

  1. Clone the repo:

    git clone [email protected]:Soluto/oidc-server-mock.git
  2. Install npm packages (run from /e2e folder):

    npm install

    Note: During the build of Docker image UI source code is fetched from github. If you experience some issues on project compile step of Docker build or on runtime try to change the branch or commit in the script.

  3. Run tests:

    npm run test

Used by

  1. Tweek blackbox tests.

  2. Stitch e2e tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].