Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Register a user

Description

The Register() method is used to register(add) a user into MTOA.

Package Details

Interface

IAccountManager

Syntax

AccountManager.Register( UserRegistrationContext registrationContext )

Returns

Task<User>

API

[POST] /api/v1/account/register

Sample request body

{
  "User": {
    "FirstName": "string",
    "LastName": "string",
    "Email": "string",
    "DisplayPhoneNumber": "string"
  },
  "AuthenticationContext": {
    "Type": "GCKey",
    "GCKey": {
      "MBUN": "string",
      "Issuer": "string"
    },
    "WindowsUserName": "string"
  }
}

Returns

UserDTO

Example

using MTOA.BLL.Interfaces;

var registrationContext = new UserRegistrationContext()
{
    AuthenticationContext = new AuthenticationContext()
    {
        GCKey = "xyz",
        Type = AuthenticationType.GCKey                    
    },
    User = new BareUser()
    {
        Email = "john.doe@tc.gc.ca",
        FirstName = "John",
        LastName = "Done"
    }
};

User user = await _accountManager.Register( registrationContext );

if (user != null)
{
    _logger.Info( $"User {user.FirstName} {user.LastName} was added successfully.");
} else {
    _logger.Error($"Failed to register user.");
}

Related references

IAccountManager.Register()
IAccountManager.SetActivationKey()

  • No labels