Login Configurations

Manage Login Configurations and User Groups with Affinidi Login Service.

Supported Languages

Package: @affinidi-tdk/login-configuration-client

npm install @affinidi-tdk/login-configuration-client --save

Package: affinidi_tdk_login_configuration_client

pip install affinidi_tdk_login_configuration_client

Classes and Methods

Configurations API

Use to manage Login Configuration to integrate Affinidi Login.

createLoginConfigurations

Create a new Login Configuration to integrate Affinidi Login.

Parameters

CreateLoginConfigurationInput [Object]

JSON object to provide the configuration details of the application. See more here.

Example
const api = new ConfigurationApi(authConfiguration)

const request: CreateLoginConfigurationInput = {
    name: 'Sample App',
    redirectUris: ['http://localhost:3000/auth/callback']
}

const { data } = await api.createLoginConfigurations(request)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.ConfigurationApi(api_client)

    request_json = "{
        name: 'Sample App',
        redirectUris: ['http://localhost:3000/auth/callback']
    }"

    create_login_configuration_input = affinidi_tdk_login_configuration_client.CreateLoginConfigurationInput.from_json(request_json)

    api_response = api_instance.create_login_configurations(create_login_configuration_input=create_login_configuration_input)

deleteLoginConfigurationsById

Delete an existing Login Configuration by ID.

Parameters

configurationId [String]

ID of the Login Configuration to delete.

Example
const api = new ConfigurationApi(authConfiguration)

// configurationID fetched from listLoginConfigurations
const configurationID : string = 'configuration_id_example'

const result = await api.deleteLoginConfigurationsById(configurationID)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.ConfigurationApi(api_client)

    configuration_id = 'configuration_id_example' 

    api_instance.delete_login_configurations_by_id(configuration_id)

getClientMetadataByClientId

Retrieves the Client Metadata info of the Login Configuration by OAuth 2.0 Client ID.

Parameters

clientId [String]

OAuth 2.0 Client ID generated by Login Configuration.

Example
const api = new ConfigurationApi(authConfiguration)

// configurationID fetched from listLoginConfigurations
const configurationID : string = 'configuration_id_example'

const { data } = await api.getClientMetadataByClientId(configurationID)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.ConfigurationApi(api_client)

    configuration_id = 'configuration_id_example' 

    api_response = api_instance.get_client_metadata_by_client_id(configuration_id)

getLoginConfigurationsById

Retrieves the Login Configuration details by ID.

Parameters

configurationId [String]

ID of the existing Login Configuration to retrieve.

Example
const api = new ConfigurationApi(authConfiguration)

// configurationID fetched from listLoginConfigurations
const configurationID : string = 'configuration_id_example'

const { data } = await api.getLoginConfigurationsById(configurationID)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.ConfigurationApi(api_client)

    configuration_id = 'configuration_id_example' 

    api_response = api_instance.get_login_configurations_by_id(configuration_id)

listLoginConfigurations

List all the Login Configurations in the Project.

Parameters

limit [Integer]

Maximum number of records to fetch from the list.

exclusiveStartKey [String]

The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation.

Example
const api = new ConfigurationApi(authConfiguration)

const { data } = await api.listLoginConfigurations()
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.ConfigurationApi(api_client)

    api_response = api_instance.list_login_configurations()

updateLoginConfigurationsById

Update an existing Login Configuration by ID

Parameters

configurationId [String]

ID of the Login Configuration to update.

UpdateLoginConfigurationInput [Object]

JSON object to provide to update the Login Configuration details. See more here.

Example
const api = new ConfigurationApi(authConfiguration)

// configurationID fetched from listLoginConfigurations
const configurationID : string = 'configuration_id_example'

// create a request object of type UpdateLoginConfigurationInput and add the attributes to be changed
const request: UpdateLoginConfigurationInput = {
    name: 'My Updated Login Config'
    redirectUris: ['http://localhost:3001/api/auth/callback']
}

const { data } = await api.updateLoginConfigurationsById(configurationID, request)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.ConfigurationApi(api_client)

    configuration_id = 'configuration_id_example' 

    # Prepare the request data which contains the attributes to be changed
    request_json = "{
        name: 'My Updated Login Config'
        redirectUris: ['http://localhost:3001/api/auth/callback']
    }"

    update_login_configuration_input = affinidi_tdk_login_configuration_client.UpdateLoginConfigurationInput.from_json(request_json)

    api_response = api_instance.update_login_configurations_by_id(configuration_id, update_login_configuration_input)

Group API

Used to manage the User Groups for the Project.

addUserToGroup

Add user to the user group.

Parameters

groupName [String]

Name of the group to add the user.

AddUserToGroupInput [Object]

JSON object to provide with the ID of the user to add. See more here.

Example
const groupApi = new GroupApi(authConfiguration)

const groupName : string = 'gold'

const userToBeAdded: AddUserToGroupInput = {
    userId: 'did:key:890890890890890',
}

const { data } = await groupApi.addUserToGroup(groupName, userToBeAdded)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.GroupApi(api_client)
    
    group_name = 'gold'

    user_to_be_added_json = "{
        user_id: 'did:key:890890890890890'
    }"
    
    add_user_to_group_input = affinidi_tdk_login_configuration_client.AddUserToGroupInput.from_json(user_to_be_added_json) 

    api_response = api_instance.add_user_to_group(group_name, add_user_to_group_input)

createGroup

Create a user group.

Parameters

CreateGroupInput [Object]

JSON object to provide the name of the user group.

Example
const groupApi = new GroupApi(authConfiguration)

const newGroupName : CreateGroupInput = {
    groupName: 'silver'
}

const { data } = await groupApi.createGroup(newGroupName)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.GroupApi(api_client)
    
    group_name_input = "{
        group_name: 'silver'
    }"
    
    create_group_input = affinidi_tdk_login_configuration_client.CreateGroupInput.from_json(group_name_input) 

    api_response = api_instance.create_group(create_group_input)

deleteGroup

Delete a group by name.

Parameters

groupName [String]

Name of the group to delete.

Example
const groupApi = new GroupApi(authConfiguration)

const groupName : string = 'bronze'

const result = await groupApi.deleteGroup(groupName)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.GroupApi(api_client)
    
    group_name = 'bronze'
    
    api_instance.delete_group(group_name)

getGroupById

Retrieve a group by the group name.

Parameters

groupName [String]

Name of the group to retrieve.

Example
const groupApi = new GroupApi(authConfiguration)

const groupName : string = 'silver'

const result = await groupApi.getGroupById(groupName)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.GroupApi(api_client)
    
    group_name = 'bronze'
    
    api_response = api_instance.get_group_by_id(group_name)

listGroupUserMappings

List all the users from the group.

Parameters

groupName [String]

Name of the group to list.

limit [Integer]

Maximum number of records to fetch in a list.

exclusiveStartKey [String]

The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation.

sortOrder [String]

sort response in specific order. By default it is in desc order.

Example
const groupApi = new GroupApi(authConfiguration)

const groupName : string = 'gold'

const { data } = await groupApi.listGroupUserMappings(groupName)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.GroupApi(api_client)
    
    group_name = 'gold' 

    limit = 56 # int | Maximum number of records to fetch in a list (optional)
    
    exclusive_start_key = 'exclusive_start_key_example' # str | The base64url encoded key of the first item that this operation will evaluate (it is not returned). Use the value that was returned in the previous operation. (optional)
    
    sort_order = 'desc'

    api_response = api_instance.list_group_user_mappings(group_name, limit=limit, exclusive_start_key=exclusive_start_key, sort_order=sort_order)

listGroups

List all the groups in the Project.

Parameters

No Parameters Required

Example
const groupApi = new GroupApi(authConfiguration)

const { data } = await groupApi.listGroups()
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.GroupApi(api_client)
    
    api_response = api_instance.list_groups()

removeUserFromGroup

Remove user from the group.

Parameters

groupName [String]

Name of the group where the user will be removed.

RemoveUserFromGroupInput [Object]

JSON object to provide the ID of the user to remove. See more here.

Example
const groupApi = new GroupApi(authConfiguration)

const groupName : string = 'gold'

const userToRemove : RemoveUserFromGroupInput = {
    userId: 'did:key:890890890890890'
}

const { data } = await groupApi.removeUserFromGroup(groupName, userToRemove)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.GroupApi(api_client)
    
    group_name = 'gold' 

    user_to_remove_json = "{
        user_id: 'did:key:890890890890890'
    }"

    remove_user_from_group_input = affinidi_tdk_login_configuration_client.RemoveUserFromGroupInput.from_json(user_to_remove_json)

    api_instance.remove_user_from_group(group_name, remove_user_from_group_input)

DenyList API

Used to block groups and users to deny access on services like Affinidi Login when users are authenticating.

blockGroups

Block users by group.

Parameters

GroupNamesInput [Object]

List of groups to block. See more here.

Example
const api = new DenyListApi(authConfiguration)

const request: GroupNamesInput = [
    'group-1',
    'group-2'
]

const { data } = await api.blockGroups(request)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.DenyListApi(api_client)

    request_json = [
        'group-1',
        'group-2'
    ]

    api_response = api_instance.block_groups(group_names_input=request_json)

blockUsers

Block by User ID (DID).

Parameters

BlockedUsersInput [Object]

List of User IDs (DIDs) to block. See more here.

Example
const api = new DenyListApi(authConfiguration)

const request: BlockedUsersInput = [
    'user-1-did',
    'user-2-did'
]

const { data } = await api.blockUsers(request)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.DenyListApi(api_client)

    request_json = [
        'user-1-did',
        'user-2-did'
    ]

    api_response = api_instance.block_users(blocked_users_input=request_json)

listBlockedGroups

Get list of blocked groups.

Parameters

pageToken [String]

Used for pagination.

Example
const api = new DenyListApi(authConfiguration)

const { data } = await api.listBlockedGroups()
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.DenyListApi(api_client)

    api_response = api_instance.list_blocked_groups()

listBlockedUsers

Get list of blocked users.

Parameters

pageToken [String]

Used for pagination.

Example
const api = new DenyListApi(authConfiguration)

const { data } = await api.listBlockedUsers()
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.DenyListApi(api_client)

    api_response = api_instance.list_blocked_users()

unblockGroups

Unblock users by group.

Parameters

GroupNamesInput [Object]

List of groups to block. See more here.

Example
const api = new DenyListApi(authConfiguration)

const request: GroupNamesInput = [
    'group-1-name',
    'group-2-name'
]

const { data } = await api.unblockGroups(request)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.DenyListApi(api_client)

    request_json = [
        'group-1-name',
        'group-2-name'
    ]

    api_response = api_instance.unblock_groups(group_names_input=request_json)

unblockUsers

Unblock by User ID (DID).

Parameters

BlockedUsersInput [Object]

List of User IDs (DIDs) to block. See more here.

Example
const api = new DenyListApi(authConfiguration)

const request: BlockedUsersInput = [
    'user-1-did',
    'user-2-did'
]

const { data } = await api.unblockUsers(request)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.DenyListApi(api_client)

    request_json = [
        'user-1-did',
        'user-2-did'
    ]

    api_response = api_instance.unblock_users(blocked_users_input=request_json)

AllowList API

Used to allow groups and users to grant access on services like Affinidi Login when users are authenticating.

allowGroups

Allows users by group.

Parameters

GroupNamesInput [Object]

List of groups to allow. See more here.

Example
const api = new AllowListApi(authConfiguration)

const request: GroupNamesInput = [
    'group-1',
    'group-2'
]

const { data } = await api.allowGroups(request)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.AllowListApi(api_client)

    request_json = [
        'group-1',
        'group-2'
    ]

    api_response = api_instance.allow_groups(group_names_input=request_json)

disallowGroups

Disallow access to users by group.

Parameters

GroupNamesInput [Object]

List of groups to disallow. See more here.

Example
const api = new AllowListApi(authConfiguration)

const request: GroupNamesInput = [
    'group-1',
    'group-2'
]

const { data } = await api.disallowGroups(request)
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.AllowListApi(api_client)

    request_json = [
        'group-1',
        'group-2'
    ]

    api_response = api_instance.disallow_groups(group_names_input=request_json)

listAllowedGroups

Get list of allowed groups.

Parameters

pageToken [String]

Used for pagination.

Example
const api = new AllowListApi(authConfiguration)

const { data } = await api.listAllowedGroups()
with affinidi_tdk_login_configuration_client.ApiClient(configuration) as api_client:
    api_instance = affinidi_tdk_login_configuration_client.AllowListApi(api_client)

    api_response = api_instance.list_allowed_groups()