This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/saml_idp/processors/aws.py
2018-12-26 21:55:37 +01:00

27 lines
984 B
Python

"""AWS Processor"""
from passbook.saml_idp.base import Processor, xml_render
class AWSProcessor(Processor):
"""AWS Response Handler Processor for testing against django-saml2-sp."""
def _determine_audience(self):
self._audience = 'urn:amazon:webservices'
def _format_assertion(self):
"""Formats _assertion_params as _assertion_xml."""
self._assertion_params['ATTRIBUTES'] = [
{
'Name': 'https://aws.amazon.com/SAML/Attributes/RoleSessionName',
'Value': self._django_request.user.username,
},
{
'Name': 'https://aws.amazon.com/SAML/Attributes/Role',
# 'Value': 'arn:aws:iam::471432361072:saml-provider/passbook_dev,
# arn:aws:iam::471432361072:role/saml_role'
}
]
self._assertion_xml = xml_render.get_assertion_xml(
'saml/xml/assertions/generic.xml', self._assertion_params, signed=True)