Skip to content

Commit

Permalink
removed local temp file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
andreloose committed Dec 28, 2017
1 parent e4216c2 commit 238fd02
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions django_saml2_auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ def get_reverse(objs):

def _get_saml_client(domain):
acs_url = domain + get_reverse([acs, 'acs', 'django_saml2_auth:acs'])
import tempfile, os
f = tempfile.NamedTemporaryFile(mode='wb', delete=False)
f.write(_urllib.urlopen(settings.SAML2_AUTH['METADATA_AUTO_CONF_URL']).read())
f.close()

saml_settings = {
'metadata': {
'local': [f.name],
'remote': [
{
"url": settings.SAML2_AUTH['METADATA_AUTO_CONF_URL'],
},
],
},
'service': {
'sp': {
Expand All @@ -89,7 +90,6 @@ def _get_saml_client(domain):
spConfig.load(saml_settings)
spConfig.allow_unknown_attributes = True
saml_client = Saml2Client(config=spConfig)
os.unlink(f.name)
return saml_client


Expand Down

0 comments on commit 238fd02

Please sign in to comment.