Package: mock-idp
Mock IDPEver needed to test an SSO setup but don't have access to the IDP for whatever
reason?Mock IDP provides a SAML2.0 IDP using POST bindings without need for a user
database or complicated enterprise software setup.PrerequisitesMock-idp requires python 3.6 and pipInstallationInstall and run mock-idp using Pip:$ pip3 install mock-idp
$ mock-idp
...Configuration FileTo override the system configuration create a config file. The service loads
config files in the following order:mockidp.yamlin the current working directory~/.mockidp.yamlin your home directory/etc/mockidp.yamlin the global config directoryinternal default config file shipped with the service packageHere is a sample (copy of built-in config) file to start with:service_providers:
  - name: "local:service:author"
    response_url: "http://localhost:3000/saml_login"

users:
  charlie:
    first_name: "Charlie"
    last_name: "Brown"
    email: "charlie@gmail.com"
    password: snoopy
  linus:
    first_name: "Linus"
    last_name: "van Pelt"
    email: "linus@gmail.com"
    password: pumpkin
  lucy:
    password: charlie
    first_name: "Lucy"
    last_name: "van Pelt"
    email: "lucy@gmail.com"
  peppermint:
    first_name: "Peppermint"
    last_name: "Patty"
    email: "peppermint@gmail.com"
    password: peppermintService providersFor each service provider (client) that uses the identity provider, an entry in
the service providers section of the config is needed. It has two values:service_providers:
  - name: "local:aem:author"
    response_url: "http://localhost:14502/saml_login"nameis the service provider entity id that the service provider sends
with each request.response_urlis the public url of the service provider. Once login has
been completed, the browser will be redirected to this url.UsersUsers is a fairly self explanatory list of user credentials recognized
by the IDP:users:
  charlie:
    first_name: "Charlie"
    last_name: "Brown"
    email: "charlie@gmail.com"
    password: snoopy
    roles:
      - administratorsConfiguring a generic Service ProviderMock-IDP supports the POST binding protocol of SAML2.0.By default mock-idp runs on port 5000 and the binding path is /saml.the response message provides four attributes:uid: The usernameemail: the user email addressfirstName: The users first namelastName: The users last nameThe logout path is /saml/logoutCertificate keysTo generate a service provider Certificate, run the following commands:$ openssl genrsa -out saml.pem 2048
$ openssl req -new -key saml.pem -out saml.csr
$ openssl x509 -req -days 365 -in saml.csr -signkey saml.pem -out saml.crtThis will produce three files:saml.pem- The private keysaml.csr- The certificate signing requestsaml.crt- The final certificateRefer to your service provider documentation on how to install the certificate.Running using DockerImport local config into a docker containerTo run the base config just start the service and map port 5000$ docker run -p 5000:5000 bjornskoglund/mock-idp:0.4.0Provided you have produced your config file containing service providers and
user account information. You can inject into a docker container by the
following:$ docker run -p 5000:5000 -v <absolute path to your config>.yaml:/usr/local/mock-idp/mockidp.yaml bjornskoglund/mock-idpCopy thecert/cert.pemfile into your Service Provider (SP), and be sure
that theISSUER(entity id) provided by theSPmatches thename:of the
Service Provider in your config.DevelopmentSetupInstall pipenv with pip to handle dependencies$ pip3 install pipenvthen install environment$ pipenv installRun from source:$ PYTHONPATH=. pipenv run bin/mock-idp
...All system config is located in mockidp/resources/default_config.yaml.CompatibilityMock-IDP has been tested with the following service providersAdobe Experience Manager (AEM) 6.2Node.js -saml2-jspackage