Skip to main content

A library that connects to ams using argo-ams-library and syncs with MITREid, SimpleSAMLphp and Keycloak

Project description

rciam-federation-registry-agent

RCIAM Federation Registry Agent main objective is to sync data between RCIAM Federation Registry and different identity and access management solutions, such as Keycloak, SATOSA, SimpleSAMLphp and MITREid Connect. This python library includes a module named ServiceRegistryAms/ to pull and publish messages from ARGO Messaging Service using the argo-ams-library, an API module named MitreidConnect/ to communicate with the API of the MITREid, an API module named Keycloak/ to communicate with the API of the Keycloak. The main standalone scripts that are used to deploy updates to the third party services are under bin/:

  • deployer_keycloak for Keycloak
  • deployer_mitreid for MITREid
  • deployer_ssp for SimpleSAMLphp

Installation

First install the packages from the requirements.txt file

pip install -r requirements.txt

Install rciam-federation-registry-agent

pip install rciam-federation-registry-agent

Usage

deployer_keycloak

deployer_keycloak requires the path of the config file as an argument

deployer_keycloak -c example_deployers.config.json

deployer_mitreid

deployer_mitreid requires the path of the config file as an argument

deployer_mitreid -c example_deployers.config.json

deployer_ssp

deployer_ssp requires the path of the config file as an argument

deployer_ssp -c example_deployers.config.json

Configuration

An example of the required configuration file can be found in conf/example_deployers.config.json. The different configuration options are described below.

{
  "keycloak": {
    "ams": {
      "host": "example.host.com",
      "project": "ams-project-name-keycloak",
      "pull_topic": "ams-topic-keycloak",
      "pull_sub": "ams-sub-keycloak",
      "token": "ams-token-keycloak",
      "pub_topic": "ams-publish-topic-keycloak",
      "poll_interval": 1
    },
    "auth_server": "https://example.com/auth",
    "realm": "example",
    "client_id": "client ID",
    "client_secret": "client secret"
  },
  "mitreid": {
    "ams": {
      "host": "example.host.com",
      "project": "ams-project-name-mitreid",
      "pull_topic": "ams-topic-mitreid",
      "pull_sub": "ams-sub-mitreid",
      "token": "ams-token-mitreid",
      "pub_topic": "ams-publish-topic-mitreid",
      "poll_interval": 1
    },
    "issuer": "https://example.com/oidc",
    "refresh_token": "refresh token",
    "client_id": "client ID",
    "client_secret": "client secret"
  },
  "ssp": {
    "ams": {
      "host": "example.host.com",
      "project": "ams-project-name-ssp",
      "pull_topic": "ams-topic-ssp",
      "pull_sub": "ams-sub-ssp",
      "token": "ams-token-ssp",
      "pub_topic": "ams-publish-topic-ssp",
      "poll_interval": 1,
      "deployer_name": "1"
    },
    "metadata_conf_file": "/path/to/ssp/metadata/file.php",
    "cron_secret": "SSP cron secret",
    "cron_url": "http://localhost/proxy/module.php/cron/cron.php",
    "cron_tag": "hourly",
    "request_timeout": 100
  },
  "log_conf": "conf/logger.conf"
}

As shown above there are three main groups, namely Keycloak, MITREid and SSP and each group can have its own AMS settings and service specific configuration values. The only global value is the log_conf path if you want to use the same logging configuration for both of the deployers. In case you need a different configuration for a deployer you can add log_conf in the scope of "MITREid" or "SSP".

ServiceRegistryAms

Use ServiceRegistryAms as a manager to pull and publish messages from AMS

from ServiceRegistryAms.PullPublish import PullPublish

with open('config.json') as json_data_file:
  config = json.load(json_data_file)
  ams = PullPublish(config)

  message = ams.pull(1)
  ams.publish(args)

Keycloak

Use Keycloak as an API manager to communicate with Keycloak

  • First obtain an access token and create the Keycloak API Client (find client_credentials_grant under Utils directory)
  access_token = client_credentials_grant(issuer_url, client_id, client_secret)
  keycloak_agent = KeycloakClientApi(issuer_url, access_token)
  • Use the following functions to create, delete and update a service on client_credentials_grant
  response = keycloak_agent.create_client(keycloak_msg)
  response = keycloak_agent.update_client(external_id, keycloak_msg)
  response = keycloak_agent.delete_client(external_id)

MITREid Connect

Use MITREid Connect as an API manager to communicate with MITREid

  • First obtain an access token and create the MITREid API Client (find refresh_token_grant under Utils directory)
  access_token = refresh_token_grant(issuer_url, refresh_token, client_id, client_secret)
  mitreid_agent = mitreidClientApi(issuer_url, access_token)
  • Use the following functions to create, delete and update a service on MITREid
  response = mitreid_agent.createClient(mitreid_msg)
  response = mitreid_agent.updateClientById(external_id, mitreid_msg)
  response = mitreid_agent.deleteClientById(external_id)

License

Apache

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rciam_federation_registry_agent-4.0.4.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rciam_federation_registry_agent-4.0.4-py2.py3-none-any.whl (28.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file rciam_federation_registry_agent-4.0.4.tar.gz.

File metadata

File hashes

Hashes for rciam_federation_registry_agent-4.0.4.tar.gz
Algorithm Hash digest
SHA256 0b43ce2855e5b72da3743b34081d5b306a3e3f012cd6ba70f5f1ed6eb8e9f98e
MD5 2192b38fc66efb62898cd6cabd0158f6
BLAKE2b-256 5ac3a2e4874fe3b3d2c808c76d3d1d6250d0c6635c124ba0f61cb37ffc4b4b69

See more details on using hashes here.

File details

Details for the file rciam_federation_registry_agent-4.0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for rciam_federation_registry_agent-4.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1a26069c7737b6ee082bc61dbc5ecc0f50e272356050fe46ae1e72743d12f113
MD5 ee9f4db475ee64b254ea28d41cf4ccc5
BLAKE2b-256 7273a5313298a12d66cefde193f06ddea836841f638b4ca2c44dc43d717bc527

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page