LinkedAuth.create - Python API

Links a security definition with an SSO user.

self.sso.user.create_linked_auth

create_linked_auth(self, cid, ust, user_id, auth_type, auth_username, is_active, current_app, remote_addr)

  • cid: Correlation ID used by audit log
  • ust: Current user's UST
  • user_id: ID of the SSO user to link an account to
  • auth_type: Type of the security definition that is being linked to the SSO user, must be 'basic_auth' or 'jwt'
  • auth_username: Username from the security definition that is to be linked to the SSO user
  • is_active: Username from the security definition that is to be linked to the SSO user
  • current_app: Name of application the call is made from
  • remote_addr: Current user's remote address
# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

class CreateLink(Service):
    def handle(self):

        # Request metadata
        current_ust = 'gAAAAABc9YDOwa4it_lLu3tHDjdKGdjHHzLTd...'
        current_app = 'CRM'
        remote_addr = '127.0.0.1'

        # ID of the user to create a link for
        user_id = 'zusr3tm8jhgqjd9smtdt7erb427s9x'

        # Account to link to the user
        auth_type = 'basic_auth'
        auth_username = 'my.account'

        # The link shall be active
        is_active = True

        # Create the link
        self.sso.user.create_linked_auth(self.cid, current_ust, user_id,
          auth_type, auth_username, is_active, current_app, remote_addr)