LinkedAuth.create - Python API

Links a security definition with an SSO user.

API

self.sso.user.create_linked_auth

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

Links a security definition with an SSO user.

Parameters:
  • cid (string) – Correlation ID used by audit log
  • ust (string) – Current user’s UST
  • user_id (string) – ID of the SSO user to link an account to
  • auth_type (string) – Type of the security definition that is being linked to the SSO user, must be ‘basic_auth’ or ‘jwt’
  • auth_username (string) – Username from the security definition that is to be linked to the SSO user
  • is_active (bool) – Username from the security definition that is to be linked to the SSO user
  • current_app (string) – Name of application the call is made from
  • remote_addr (string) – Current user’s remote address
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-

from __future__ import absolute_import, division, print_function, unicode_literals

# 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)