NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!

Please go ahead to the new site!

Authorisation Service (python)

If you need more information on this subject, please, see Authorisations.

List of all options:

  • Authorisations management
  • Authorisation types management
  • Authorisation sources management
  • Authorisation grant right management (OIDC only)

Authorisations management

from trivoreid.models.paycard import Authorisation
from trivoreid.utils.criteria import Filter

# Get list of all authorizations
page = api.authorization_service.get_all()

# Apply filter
filt = Filter(Filter.EQUAL, 'revoked', True)
page = api.paycard_service.get_all(filt)

# Add new Authorisation
auth = Authorisation()
auth.subject.type = 'User'
auth.object.type = 'User'

authType = api.authorization_service.get_all_types().resources[0]
auth.authType = authType.code

# This method returns authorisation object with the generated ID
auth = api.authorization_service.create(auth)
authId = auth.id

# Revoke Authorization
api.authorization_service.revoke(authId)

# Get one, Update and Delete
auth = api.authorization_service.get(authId)

auth.validTo = '2022-10-20T07:17:17.606Z'
auth = api.authorization_service.update(auth)

api.authorization_service.delete(authId)

Authorisation types management

from trivoreid.models.paycard import AuthorisationType
from trivoreid.utils.criteria import Filter

# Get list of all authorization types
page = api.authorization_service.get_all_types()

# Apply filter
filt = Filter(Filter.EQUAL, 'code', 'examplecode')
page = api.paycard_service.get_all_types(filt)

# Add new Authorisation Type
auth_type = AuthorisationType()
auth_type.nsCode = 'nsCode'
auth_type.code = 'exampleCode'

# This method returns authorisation type object with the generated ID
auth_type = api.authorization_service.create_type(auth_type)
typeId = auth_type.id

# Get one, Update and Delete
auth_type = api.authorization_service.get_type(typeId)

auth_type.description = 'Example'
auth_type = api.authorization_service.update_type(auth_type)

api.authorization_service.delete_type(typeId)

Authorisation sources management

from trivoreid.models.paycard import AuthorisationType
from trivoreid.utils.criteria import Filter

# Get list of all authorization sources
page = api.authorization_service.get_all_sources()

# Apply filter
filt = Filter(Filter.EQUAL, 'code', 'examplecode')
page = api.paycard_service.get_all_sources(filt)

# Add new Authorisation Type
auth_source = AuthorisationType()
auth_source.nsCode = 'nsCode'
auth_source.code = 'exampleCode'

# This method returns authorisation type object with the generated ID
auth_source = api.authorization_service.create_source(auth_source)
sourceId = auth_source.id

# Get one, Update and Delete
auth_source = api.authorization_service.get_source(sourceId)

auth_source.description = 'Example'
auth_source = api.authorization_service.update_source(auth_source)

api.authorization_service.delete_source(sourceId)

Authorization grant right management

from trivoreid.models.paycard import AuthorisationGrantRight
from trivoreid.utils.criteria import Filter

# Get list of all authorization grant rights
page = api.authorization_service.get_all_grant_rights()

# Apply filter
filt = Filter(Filter.EQUAL, 'code', 'examplecode')
page = api.paycard_service.get_all_sources(filt)

# Add new Authorisation Type
right = AuthorisationGrantRight()

right.principal.type = 'User'
right.principal.value = userId

# This method returns authorisation grant right object with the generated ID
right = api.authorization_service.create_grant_right(right)
rightId = right.id

# Get one and revoke
right = api.authorization_service.get_grant_right(rightId)

api.authorization_service.revoke_grant_right(rightId)

Authorisation Service Models

/wiki/spaces/TISpubdoc/pages/20515243

/wiki/spaces/TISpubdoc/pages/20515214

/wiki/spaces/TISpubdoc/pages/20515215

/wiki/spaces/TISpubdoc/pages/20515242

/wiki/spaces/TISpubdoc/pages/20515241

Principal

NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!