Skip to content

Commit

Permalink
Merge pull request fangli#37 from andreloose/master
Browse files Browse the repository at this point in the history
removed local temp file creation
  • Loading branch information
fangli authored Dec 29, 2017
2 parents 275d56a + 238fd02 commit 633def4
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 @@ -63,13 +63,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 @@ -92,7 +93,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 633def4

Please sign in to comment.