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.
2018-12-26 20:55:37 +00:00
|
|
|
"""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."""
|
2019-03-08 11:47:50 +00:00
|
|
|
super()._format_assertion()
|
|
|
|
self._assertion_params['ATTRIBUTES'].append(
|
2018-12-26 20:55:37 +00:00
|
|
|
{
|
|
|
|
'Name': 'https://aws.amazon.com/SAML/Attributes/RoleSessionName',
|
|
|
|
'Value': self._django_request.user.username,
|
|
|
|
}
|
2019-03-08 11:47:50 +00:00
|
|
|
)
|
2018-12-26 20:55:37 +00:00
|
|
|
self._assertion_xml = xml_render.get_assertion_xml(
|
|
|
|
'saml/xml/assertions/generic.xml', self._assertion_params, signed=True)
|