|
|
@@ -15,20 +15,30 @@
|
|
|
# limitations under the License.
|
|
|
|
|
|
import saml2
|
|
|
-import huesaml.conf
|
|
|
+import desktop.conf
|
|
|
+import libsaml.conf
|
|
|
+
|
|
|
+from desktop.lib import security_util
|
|
|
+
|
|
|
|
|
|
__all__ = ['SAML_CONFIG', 'SAML_ATTRIBUTE_MAPPING', 'SAML_CREATE_UNKNOWN_USER']
|
|
|
|
|
|
|
|
|
+BASE_URL = "%(protocol)s%(host)s:%(port)d" % {
|
|
|
+ 'protocol': desktop.conf.is_https_enabled() and 'https://' or 'http://',
|
|
|
+ 'host': desktop.conf.HTTP_HOST.get() == '0.0.0.0' and security_util.get_localhost_name() or desktop.conf.HTTP_HOST.get(),
|
|
|
+ 'port': desktop.conf.HTTP_PORT.get()
|
|
|
+}
|
|
|
+
|
|
|
SAML_CONFIG = {
|
|
|
# full path to the xmlsec1 binary programm
|
|
|
- 'xmlsec_binary': huesaml.conf.XMLSEC_BINARY.get(),
|
|
|
+ 'xmlsec_binary': libsaml.conf.XMLSEC_BINARY.get(),
|
|
|
|
|
|
# your entity id, usually your subdomain plus the url to the metadata view
|
|
|
- 'entityid': huesaml.conf.ENTITY_ID.get(),
|
|
|
+ 'entityid': "%s/saml2/metadata/" % BASE_URL,
|
|
|
|
|
|
# directory with attribute mapping
|
|
|
- 'attribute_map_dir': huesaml.conf.ATTRIBUTE_MAP_DIR.get(),
|
|
|
+ 'attribute_map_dir': libsaml.conf.ATTRIBUTE_MAP_DIR.get(),
|
|
|
|
|
|
# this block states what services we provide
|
|
|
'service': {
|
|
|
@@ -38,37 +48,37 @@ SAML_CONFIG = {
|
|
|
# url and binding to the assetion consumer service view
|
|
|
# do not change the binding or service name
|
|
|
'assertion_consumer_service': [
|
|
|
- (huesaml.conf.ASSERTION_CONSUMER_SERVICE_URI.get(), saml2.BINDING_HTTP_POST),
|
|
|
+ ("%s/saml2/acs/" % BASE_URL, saml2.BINDING_HTTP_POST),
|
|
|
],
|
|
|
# url and binding to the single logout service view
|
|
|
# do not change the binding or service name
|
|
|
'single_logout_service': [
|
|
|
- (huesaml.conf.SINGLE_LOGOUT_SERVICE_URI.get(), saml2.BINDING_HTTP_REDIRECT),
|
|
|
+ ("%s/saml2/ls/" % BASE_URL, saml2.BINDING_HTTP_REDIRECT),
|
|
|
],
|
|
|
},
|
|
|
|
|
|
- 'allow_unsolicited': huesaml.conf.ALLOW_UNSOLICITED.get(),
|
|
|
+ 'allow_unsolicited': libsaml.conf.ALLOW_UNSOLICITED.get(),
|
|
|
|
|
|
# attributes that this project need to identify a user
|
|
|
- 'required_attributes': huesaml.conf.REQUIRED_ATTRIBUTES.get(),
|
|
|
+ 'required_attributes': libsaml.conf.REQUIRED_ATTRIBUTES.get(),
|
|
|
|
|
|
# attributes that may be useful to have but not required
|
|
|
- 'optional_attributes': huesaml.conf.OPTIONAL_ATTRIBUTES.get(),
|
|
|
+ 'optional_attributes': libsaml.conf.OPTIONAL_ATTRIBUTES.get(),
|
|
|
},
|
|
|
},
|
|
|
|
|
|
# where the remote metadata is stored
|
|
|
'metadata': {
|
|
|
- 'local': huesaml.conf.METADATA_FILE.get(),
|
|
|
+ 'local': [ libsaml.conf.METADATA_FILE.get() ],
|
|
|
},
|
|
|
|
|
|
# set to 1 to output debugging information
|
|
|
'debug': 1,
|
|
|
|
|
|
# certificate
|
|
|
- 'key_file': huesaml.conf.KEY_FILE.get(),
|
|
|
- 'cert_file': huesaml.conf.CERT_FILE.get()
|
|
|
+ 'key_file': libsaml.conf.KEY_FILE.get(),
|
|
|
+ 'cert_file': libsaml.conf.CERT_FILE.get()
|
|
|
}
|
|
|
|
|
|
-SAML_ATTRIBUTE_MAPPING = huesaml.conf.USER_ATTRIBUTE_MAPPING.get()
|
|
|
-SAML_CREATE_UNKNOWN_USER = huesaml.conf.CREATE_USERS_ON_LOGIN.get()
|
|
|
+SAML_ATTRIBUTE_MAPPING = libsaml.conf.USER_ATTRIBUTE_MAPPING.get()
|
|
|
+SAML_CREATE_UNKNOWN_USER = libsaml.conf.CREATE_USERS_ON_LOGIN.get()
|