User.signup - Python API

Lets users sign up themselves with the system. In Python, a zato.sso.SignupCtx object is created and filled in with details of the user about to be signed up.

Input is validated according to configuration from sso.conf. All callback services are executed if the user has been created successfully.

On output, confirmation token is returned that may be used to let a user know via email that their account has been prepared but needs to be confirmed by clicking on a selected link. The token is URL-safe and 192-bit strong.

SignupCtx has the following properties:

Name Datatype Optional? Notes
username string --- Username to create
password string --- User's password
email string Yes User's email
current_app string --- Name of the application the user is signing up through
app_list list --- A list of applications that the user wants to sign up to (all must exist in sso.conf)


signup(self, cid, ctx, current_app, remote_addr)

  • cid: Correlation ID used by audit log
  • ctx: Signup configuration
  • current_app: Name of application the current user is issuing the call from
  • remote_addr: User's remote address
  • Returns: A confirmation token that may be used by the user to confirm that account's creation
# -*- coding: utf-8 -*-

# stdlib
from uuid import uuid4

# Zato
from zato.server.service import Service
from zato.sso import const, SignupCtx

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

         # Signup data
         username = 'my.username'
         email = ''
         password = uuid4().hex
         app_list = ['CRM']

         # Prepare the context object
         ctx = SignupCtx()
         ctx.username = username = email
         ctx.password = password
         ctx.app_list = app_list

         # Sign up the user
         confirm_token = self.sso.user.signup(self.cid, ctx, 'CRM', '')

         # Log the confirmation token received'Token`: %s', confirm_token)
INFO - Token: v9IEOwbBr0JEsboKyleAp6yuKwIEzmJ0