gpt4 book ai didi

djangosaml2 : cannot serialize IdpUnspecified ('No IdP to send to given the premises' , )(类型 IdpUnspecified)

转载 作者:行者123 更新时间:2023-12-03 02:27:38 29 4
gpt4 key购买 nike

我正在尝试让 djangosaml2 工作,我已尝试尽可能针对 https://openidp.feide.no/ 配置设置但是当我导航到/saml2/login/时出现以下错误:

cannot serialize IdpUnspecified('No IdP to send to given the premises',) (type IdpUnspecified)

这就是我的设置

LOGIN_URL = '/saml2/login/'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
from os import path
import saml2
BASEDIR = path.dirname(path.abspath(__file__))
SAML_CONFIG = {
# full path to the xmlsec1 binary programm
'xmlsec_binary': '/usr/bin/xmlsec1',

# your entity id, usually your subdomain plus the url to the metadata view
'entityid': 'http://localhost:8000/saml2/metadata/',

# directory with attribute mapping
'attribute_map_dir': path.join(BASEDIR, 'attributemaps'),

# this block states what services we provide
'service': {
# we are just a lonely SP
'sp' : {
'name': 'Just a saml test SP',
'endpoints': {
# url and binding to the assetion consumer service view
# do not change the binding or service name
'assertion_consumer_service': [
('http://localhost:8000/saml2/acs/',
saml2.BINDING_HTTP_POST),
],
# url and binding to the single logout service view
# do not change the binding or service name
'single_logout_service': [
('http://localhost:8000/saml2/ls/',
saml2.BINDING_HTTP_REDIRECT),
],
},

# attributes that this project need to identify a user
'required_attributes': ['uid'],

# attributes that may be useful to have but not required
'optional_attributes': ['eduPersonAffiliation'],

# in this section the list of IdPs we talk to are defined
'idp': {
# we do not need a WAYF service since there is
# only an IdP defined here. This IdP should be
# present in our metadata

# the keys of this dictionary are entity ids
'https://openidp.feide.no/simplesaml/saml2/idp/metadata.php': {
'single_sign_on_service': {
saml2.BINDING_HTTP_REDIRECT: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php',
},
'single_logout_service': {
saml2.BINDING_HTTP_REDIRECT: 'https://openidp.feide.no/simplesaml/saml2/idp/SingleLogoutService.php',
},
},
},
},
},

# where the remote metadata is stored
'metadata': {
'local': [path.join(BASEDIR, 'remote_metadata.xml')],
},

# set to 1 to output debugging information
'debug': 1,

# certificate
'key_file': path.join(BASEDIR, 'mycert.key'), # private part
'cert_file': path.join(BASEDIR, 'mycert.pem'), # public part

# own metadata settings
'contact_person': [
{'given_name': 'James',
'sur_name': 'Lin',
'company': 'Company',
'email_address': 'james@james.com',
'contact_type': 'technical'},
],
# you can set multilanguage information here
'organization': {
'name': [('Company', 'en'),],
'display_name': [('Company', 'en')],
'url': [('http://www.company.com', 'en')],
},
'valid_for': 24, # how long is our metadata valid
}

最佳答案

好的!我从这里得到了旧指令https://pypi.python.org/pypi/djangosaml2/0.1.0但是当我通过 PIP 安装时,它安装了最新版本,最新指令在这里 https://bitbucket.org/lgs/djangosaml2

深入研究代码后,我终于发现 idp 键应该是“idpsso”,如下所示:

'idpsso': {        
# we do not need a WAYF service since there is
# only an IdP defined here. This IdP should be
# present in our metadata

# the keys of this dictionary are entity ids
'https://openidp.feide.no/simplesaml/saml2/idp/metadata.php': {
'single_sign_on_service': {
saml2.BINDING_HTTP_REDIRECT: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php',
},
'single_logout_service': {
saml2.BINDING_HTTP_REDIRECT: 'https://openidp.feide.no/simplesaml/saml2/idp/SingleLogoutService.php',
},
},
},
},

关于djangosaml2 : cannot serialize IdpUnspecified ('No IdP to send to given the premises' , )(类型 IdpUnspecified),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18868497/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com