From b9ce7d98c20f84a25b422d447d74d48c1caf176b Mon Sep 17 00:00:00 2001 From: Sixto Martin Date: Sun, 1 Oct 2023 02:19:27 +0200 Subject: [PATCH] Remove outdated docs --- docs/saml2/.buildinfo | 4 - docs/saml2/_modules/index.html | 101 - docs/saml2/_modules/saml2/auth.html | 460 - docs/saml2/_modules/saml2/authn_request.html | 176 - docs/saml2/_modules/saml2/constants.html | 166 - docs/saml2/_modules/saml2/errors.html | 135 - docs/saml2/_modules/saml2/logout_request.html | 372 - .../saml2/_modules/saml2/logout_response.html | 282 - docs/saml2/_modules/saml2/metadata.html | 289 - docs/saml2/_modules/saml2/response.html | 532 - docs/saml2/_modules/saml2/settings.html | 695 -- docs/saml2/_modules/saml2/utils.html | 805 -- docs/saml2/_sources/index.txt | 23 - docs/saml2/_sources/saml2.txt | 83 - docs/saml2/_static/ajax-loader.gif | Bin 673 -> 0 bytes docs/saml2/_static/basic.css | 540 - docs/saml2/_static/comment-bright.png | Bin 3500 -> 0 bytes docs/saml2/_static/comment-close.png | Bin 3578 -> 0 bytes docs/saml2/_static/comment.png | Bin 3445 -> 0 bytes docs/saml2/_static/default.css | 256 - docs/saml2/_static/doctools.js | 247 - docs/saml2/_static/down-pressed.png | Bin 368 -> 0 bytes docs/saml2/_static/down.png | Bin 363 -> 0 bytes docs/saml2/_static/file.png | Bin 392 -> 0 bytes docs/saml2/_static/jquery.js | 9404 ----------------- docs/saml2/_static/minus.png | Bin 199 -> 0 bytes docs/saml2/_static/plus.png | Bin 199 -> 0 bytes docs/saml2/_static/pygments.css | 62 - docs/saml2/_static/searchtools.js | 567 - docs/saml2/_static/sidebar.js | 151 - docs/saml2/_static/underscore.js | 1226 --- docs/saml2/_static/up-pressed.png | Bin 372 -> 0 bytes docs/saml2/_static/up.png | Bin 363 -> 0 bytes docs/saml2/_static/websupport.js | 808 -- docs/saml2/genindex.html | 941 -- docs/saml2/index.html | 142 - docs/saml2/objects.inv | Bin 1959 -> 0 bytes docs/saml2/py-modindex.html | 154 - docs/saml2/saml2.html | 2044 ---- docs/saml2/search.html | 107 - docs/saml2/searchindex.js | 1 - 41 files changed, 20773 deletions(-) delete mode 100644 docs/saml2/.buildinfo delete mode 100644 docs/saml2/_modules/index.html delete mode 100644 docs/saml2/_modules/saml2/auth.html delete mode 100644 docs/saml2/_modules/saml2/authn_request.html delete mode 100644 docs/saml2/_modules/saml2/constants.html delete mode 100644 docs/saml2/_modules/saml2/errors.html delete mode 100644 docs/saml2/_modules/saml2/logout_request.html delete mode 100644 docs/saml2/_modules/saml2/logout_response.html delete mode 100644 docs/saml2/_modules/saml2/metadata.html delete mode 100644 docs/saml2/_modules/saml2/response.html delete mode 100644 docs/saml2/_modules/saml2/settings.html delete mode 100644 docs/saml2/_modules/saml2/utils.html delete mode 100644 docs/saml2/_sources/index.txt delete mode 100644 docs/saml2/_sources/saml2.txt delete mode 100644 docs/saml2/_static/ajax-loader.gif delete mode 100644 docs/saml2/_static/basic.css delete mode 100644 docs/saml2/_static/comment-bright.png delete mode 100644 docs/saml2/_static/comment-close.png delete mode 100644 docs/saml2/_static/comment.png delete mode 100644 docs/saml2/_static/default.css delete mode 100644 docs/saml2/_static/doctools.js delete mode 100644 docs/saml2/_static/down-pressed.png delete mode 100644 docs/saml2/_static/down.png delete mode 100644 docs/saml2/_static/file.png delete mode 100644 docs/saml2/_static/jquery.js delete mode 100644 docs/saml2/_static/minus.png delete mode 100644 docs/saml2/_static/plus.png delete mode 100644 docs/saml2/_static/pygments.css delete mode 100644 docs/saml2/_static/searchtools.js delete mode 100644 docs/saml2/_static/sidebar.js delete mode 100644 docs/saml2/_static/underscore.js delete mode 100644 docs/saml2/_static/up-pressed.png delete mode 100644 docs/saml2/_static/up.png delete mode 100644 docs/saml2/_static/websupport.js delete mode 100644 docs/saml2/genindex.html delete mode 100644 docs/saml2/index.html delete mode 100644 docs/saml2/objects.inv delete mode 100644 docs/saml2/py-modindex.html delete mode 100644 docs/saml2/saml2.html delete mode 100644 docs/saml2/search.html delete mode 100644 docs/saml2/searchindex.js diff --git a/docs/saml2/.buildinfo b/docs/saml2/.buildinfo deleted file mode 100644 index 5e197dbf..00000000 --- a/docs/saml2/.buildinfo +++ /dev/null @@ -1,4 +0,0 @@ -# Sphinx build info version 1 -# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: e10660514f5c62e16e90878c60a15170 -tags: fbb0d17656682115ca4d033fb2f83ba1 diff --git a/docs/saml2/_modules/index.html b/docs/saml2/_modules/index.html deleted file mode 100644 index d672e465..00000000 --- a/docs/saml2/_modules/index.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - Overview: module code — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - -
- -
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/auth.html b/docs/saml2/_modules/saml2/auth.html deleted file mode 100644 index 243bd4db..00000000 --- a/docs/saml2/_modules/saml2/auth.html +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - - - - - saml2.auth — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.auth

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-from base64 import b64encode
-from urllib import urlencode, quote
-from xml.etree.ElementTree import tostring
-
-import dm.xmlsec.binding as xmlsec
-
-from saml2.settings import OneLogin_Saml2_Settings
-from saml2.response import OneLogin_Saml2_Response
-from saml2.errors import OneLogin_Saml2_Error
-from saml2.logout_response import OneLogin_Saml2_Logout_Response
-from saml2.constants import OneLogin_Saml2_Constants
-from saml2.utils import OneLogin_Saml2_Utils
-from saml2.logout_request import OneLogin_Saml2_Logout_Request
-from saml2.authn_request import OneLogin_Saml2_Authn_Request
-
-
-
[docs]class OneLogin_Saml2_Auth(object): - - def __init__(self, request_data, old_settings=None): - """ - Initializes the SP SAML instance. - - Arguments are: - * (dict) old_settings. Setting data - """ - self.__request_data = request_data - self.__settings = OneLogin_Saml2_Settings(old_settings) - self.__attributes = [] - self.__nameid = '' - self.__authenticated = False - self.__errors = [] - -
[docs] def get_settings(self): - """ - Returns the settings info - :return: Setting info - :rtype: OneLogin_Saml2_Setting object - """ - return self.__settings -
-
[docs] def set_strict(self, value): - """ - Set the strict mode active/disable - - :param value: - :type value: bool - """ - assert isinstance(value, bool) - self.__settings.set_strict(value) -
-
[docs] def process_response(self, request_id=None): - """ - Process the SAML Response sent by the IdP. - - :param request_id: Is an optional argumen. Is the ID of the AuthNRequest sent by this SP to the IdP. - :type request_id: string - - :raises: OneLogin_Saml2_Error.SAML_RESPONSE_NOT_FOUND, when a POST with a SAMLResponse is not found - """ - self.__errors = [] - - if 'post_data' in self.__request_data and 'SAMLResponse' in self.__request_data['post_data']: - # AuthnResponse -- HTTP_POST Binding - response = OneLogin_Saml2_Response(self.__settings, self.__request_data['post_data']['SAMLResponse']) - - if response.is_valid(request_id): - self.__attributes = response.get_attributes() - self.__nameid = response.get_nameid() - self.__authenticated = True - else: - self.__errors.append('invalid_response') - - else: - self.__errors.append('invalid_binding') - raise OneLogin_Saml2_Error( - 'SAML Response not found, Only supported HTTP_POST Binding', - OneLogin_Saml2_Error.SAML_RESPONSE_NOT_FOUND - ) -
-
[docs] def process_slo(self, keep_local_session=False, request_id=None, delete_session_cb=None): - """ - Process the SAML Logout Response / Logout Request sent by the IdP. - - :param keep_local_session: When false will destroy the local session, otherwise will destroy it - :type keep_local_session: bool - - :param request_id: The ID of the LogoutRequest sent by this SP to the IdP - :type request_id: string - - :returns: Redirection url - """ - self.__errors = [] - - if 'get_data' in self.__request_data and 'SAMLResponse' in self.__request_data['get_data']: - logout_response = OneLogin_Saml2_Logout_Response(self.__settings, self.__request_data['get_data']['SAMLResponse']) - if not logout_response.is_valid(self.__request_data, request_id): - self.__errors.append('invalid_logout_response') - elif logout_response.get_status() != OneLogin_Saml2_Constants.STATUS_SUCCESS: - self.__errors.append('logout_not_success') - elif not keep_local_session: - OneLogin_Saml2_Utils.delete_local_session(delete_session_cb) - - elif 'get_data' in self.__request_data and 'SAMLRequest' in self.__request_data['get_data']: - request = OneLogin_Saml2_Utils.decode_base64_and_inflate(self.__request_data['get_data']['SAMLRequest']) - if not OneLogin_Saml2_Logout_Request.is_valid(self.__settings, request, self.__request_data): - self.__errors.append('invalid_logout_request') - else: - if not keep_local_session: - OneLogin_Saml2_Utils.delete_local_session(delete_session_cb) - - in_response_to = OneLogin_Saml2_Logout_Request.get_id(request) - response_builder = OneLogin_Saml2_Logout_Response(self.__settings) - response_builder.build(in_response_to) - logout_response = response_builder.get_response() - - parameters = {'SAMLResponse': logout_response} - if 'RelayState' in self.__request_data['get_data']: - parameters['RelayState'] = self.__request_data['get_data']['RelayState'] - - security = self.__settings.get_security_data() - if 'logoutResponseSigned' in security and security['logoutResponseSigned']: - signature = self.build_response_signature(logout_response, parameters.get('RelayState', None)) - parameters['SigAlg'] = OneLogin_Saml2_Constants.RSA_SHA1 - parameters['Signature'] = signature - - return self.redirect_to(self.get_slo_url(), parameters) - - else: - self.__errors.append('invalid_binding') - raise OneLogin_Saml2_Error( - 'SAML LogoutRequest/LogoutResponse not found. Only supported HTTP_REDIRECT Binding', - OneLogin_Saml2_Error.SAML_LOGOUTMESSAGE_NOT_FOUND - ) -
-
[docs] def redirect_to(self, url=None, parameters={}): - """ - Redirects the user to the url past by parameter or to the url that we defined in our SSO Request. - - :param url: The target URL to redirect the user - :type url: string - :param parameters: Extra parameters to be passed as part of the url - :type parameters: dict - - :returns: Redirection url - """ - if url is None and 'RelayState' in self.__request_data['get_data']: - url = self.__request_data['get_data']['RelayState'] - return OneLogin_Saml2_Utils.redirect(url, parameters, request_data=self.__request_data) -
-
[docs] def is_authenticated(self): - """ - Checks if the user is authenticated or not. - - :returns: True if is authenticated, False if not - :rtype: bool - """ - return self.__authenticated -
-
[docs] def get_attributes(self): - """ - Returns the set of SAML attributes. - - :returns: SAML attributes - :rtype: dict - """ - return self.__attributes -
-
[docs] def get_nameid(self): - """ - Returns the nameID. - - :returns: NameID - :rtype: string - """ - return self.__nameid -
-
[docs] def get_errors(self): - """ - Returns a list with code errors if something went wrong - - :returns: List of errors - :rtype: list - """ - return self.__errors -
-
[docs] def get_attribute(self, name): - """ - Returns the requested SAML attribute. - - :param name: Name of the attribute - :type name: string - - :returns: Attribute value if exists or None - :rtype: string - """ - assert isinstance(name, basestring) - value = None - if name in self.__attributes.keys(): - value = self.__attributes[name] - return value -
-
[docs] def login(self, return_to=None): - """ - Initiates the SSO process. - - :param return_to: Optional argument. The target URL the user should be redirected to after login. - :type return_to: string - - :returns: Redirection url - """ - authn_request = OneLogin_Saml2_Authn_Request(self.__settings) - - saml_request = authn_request.get_request() - parameters = {'SAMLRequest': saml_request} - - if return_to is not None: - parameters['RelayState'] = return_to - else: - parameters['RelayState'] = OneLogin_Saml2_Utils.get_self_url_no_query(self.__request_data) - - security = self.__settings.get_security_data() - if security.get('authnRequestsSigned', False): - parameters['SigAlg'] = OneLogin_Saml2_Constants.RSA_SHA1 - parameters['Signature'] = self.build_request_signature(saml_request, parameters['RelayState']) - return self.redirect_to(self.get_sso_url(), parameters) -
-
[docs] def logout(self, return_to=None, name_id=None, session_index=None): - """ - Initiates the SLO process. - - :param return_to: Optional argument. The target URL the user should be redirected to after logout. - :type return_to: string - :param name_id: Optional argument. The NameID that will be set in the LogoutRequest. - :type name_id: string - :param session_index: Optional argument. SessionIndex that identifies the session of the user. - :type session_index: string - :returns: Redirection url - """ - slo_url = self.get_slo_url() - if slo_url is None: - raise OneLogin_Saml2_Error( - 'The IdP does not support Single Log Out', - OneLogin_Saml2_Error.SAML_SINGLE_LOGOUT_NOT_SUPPORTED - ) - - logout_request = OneLogin_Saml2_Logout_Request(self.__settings) - - saml_request = logout_request.get_request() - - parameters = {'SAMLRequest': logout_request.get_request()} - if return_to is not None: - parameters['RelayState'] = return_to - else: - parameters['RelayState'] = OneLogin_Saml2_Utils.get_self_url_no_query(self.__request_data) - - security = self.__settings.get_security_data() - if security.get('logoutRequestSigned', False): - parameters['SigAlg'] = OneLogin_Saml2_Constants.RSA_SHA1 - parameters['Signature'] = self.build_request_signature(saml_request, parameters['RelayState']) - return self.redirect_to(slo_url, parameters) -
-
[docs] def get_sso_url(self): - """ - Gets the SSO url. - - :returns: An URL, the SSO endpoint of the IdP - :rtype: string - """ - idp_data = self.__settings.get_idp_data() - return idp_data['singleSignOnService']['url'] -
-
[docs] def get_slo_url(self): - """ - Gets the SLO url. - - :returns: An URL, the SLO endpoint of the IdP - :rtype: string - """ - url = None - idp_data = self.__settings.get_idp_data() - if 'singleLogoutService' in idp_data.keys() and 'url' in idp_data['singleLogoutService']: - url = idp_data['singleLogoutService']['url'] - return url -
-
[docs] def build_request_signature(self, saml_request, relay_state): - """ - Builds the Signature of the SAML Request. - - :param saml_request: The SAML Request - :type saml_request: string - - :param relay_state: The target URL the user should be redirected to - :type relay_state: string - """ - if not self.__settings.check_sp_certs(): - raise OneLogin_Saml2_Error( - "Trying to sign the SAML Request but can't load the SP certs", - OneLogin_Saml2_Error.SP_CERTS_NOT_FOUND - ) - - xmlsec.initialize() - - # Load the key into the xmlsec context - key = self.__settings.get_sp_key() - file_key = OneLogin_Saml2_Utils.write_temp_file(key) # FIXME avoid writing a file - - dsig_ctx = xmlsec.DSigCtx() - dsig_ctx.signKey = xmlsec.Key.load(file_key.name, xmlsec.KeyDataFormatPem, None) - file_key.close() - - data = { - 'SAMLRequest': quote(saml_request), - 'RelayState': quote(relay_state), - 'SignAlg': quote(OneLogin_Saml2_Constants.RSA_SHA1), - } - msg = urlencode(data) - signature = dsig_ctx.signBinary(msg, xmlsec.TransformRsaSha1) - return b64encode(signature) -
-
[docs] def build_response_signature(self, saml_response, relay_state): - """ - Builds the Signature of the SAML Response. - :param saml_request: The SAML Response - :type saml_request: string - - :param relay_state: The target URL the user should be redirected to - :type relay_state: string - """ - if not self.__settings.check_sp_certs(): - raise OneLogin_Saml2_Error( - "Trying to sign the SAML Response but can't load the SP certs", - OneLogin_Saml2_Error.SP_CERTS_NOT_FOUND - ) - - xmlsec.initialize() - - # Load the key into the xmlsec context - key = self.__settings.get_sp_key() - file_key = OneLogin_Saml2_Utils.write_temp_file(key) # FIXME avoid writing a file - - dsig_ctx = xmlsec.DSigCtx() - dsig_ctx.signKey = xmlsec.Key.load(file_key.name, xmlsec.KeyDataFormatPem, None) - file_key.close() - - data = { - 'SAMLResponse': quote(saml_response), - 'RelayState': quote(relay_state), - 'SignAlg': quote(OneLogin_Saml2_Constants.RSA_SHA1), - } - msg = urlencode(data) - import pdb; dbp.set_trace() - print msg - data2 = { - 'SAMLResponse': saml_response, - 'RelayState': relay_state, - 'SignAlg': OneLogin_Saml2_Constants.RSA_SHA1, - } - msg2 = urlencode(data2) - print msg2 - signature = dsig_ctx.signBinary(msg, xmlsec.TransformRsaSha1) - return b64encode(signature)
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/authn_request.html b/docs/saml2/_modules/saml2/authn_request.html deleted file mode 100644 index 207ee7a6..00000000 --- a/docs/saml2/_modules/saml2/authn_request.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - - - saml2.authn_request — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.authn_request

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-from base64 import b64encode
-from datetime import datetime
-from zlib import compress
-
-from saml2.utils import OneLogin_Saml2_Utils
-from saml2.constants import OneLogin_Saml2_Constants
-
-
-
[docs]class OneLogin_Saml2_Authn_Request: - - def __init__(self, settings): - """ - Constructs the AuthnRequest object. - - Arguments are: - * (OneLogin_Saml2_Settings) settings. Setting data - """ - self.__settings = settings - - sp_data = self.__settings.get_sp_data() - security = self.__settings.get_security_data() - - uid = OneLogin_Saml2_Utils.generate_unique_id() - issue_instant = OneLogin_Saml2_Utils.parse_time_to_SAML( - int(datetime.now().strftime("%s")) - ) - - name_id_policy_format = sp_data['NameIDFormat'] - if 'wantNameIdEncrypted' in security and security['wantNameIdEncrypted']: - name_id_policy_format = OneLogin_Saml2_Constants.NAMEID_ENCRYPTED - - provider_name_str = '' - organization_data = settings.get_organization() - if isinstance(organization_data, dict): - langs = organization_data.keys() - if 'en-US' in langs: - lang = 'en-US' - else: - lang = langs[0] - if 'displayname' in organization_data[lang] and organization_data[lang]['displayname'] is not None: - provider_name_str = 'ProviderName="%s"' % organization_data[lang]['displayname'] - - request = """<samlp:AuthnRequest - xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" - ID="%(id)s" - Version="2.0" - %(provider_name)s - IssueInstant="%(issue_instant)s" - ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" - AssertionConsumerServiceURL="%(assertion_url)s"> - <saml:Issuer>%(entity_id)s</saml:Issuer> - <samlp:NameIDPolicy - Format="%(name_id_policy)s" - AllowCreate="true" /> - <samlp:RequestedAuthnContext Comparison="exact"> - <saml:AuthnContextMethodRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextMethodRef> - </samlp:RequestedAuthnContext> -</samlp:AuthnRequest>""" % { - 'id': uid, - 'provider_name': provider_name_str, - 'issue_instant': issue_instant, - 'assertion_url': sp_data['assertionConsumerService']['url'], - 'entity_id': sp_data['entityId'], - 'name_id_policy': name_id_policy_format, - } - - self.__authn_request = request - -
[docs] def get_request(self): - """ - Returns unsigned AuthnRequest. - :return: Unsigned AuthnRequest - :rtype: str object - """ - deflated_request = compress(self.__authn_request)[2:-4] - return b64encode(deflated_request)
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/constants.html b/docs/saml2/_modules/saml2/constants.html deleted file mode 100644 index 306ec1b3..00000000 --- a/docs/saml2/_modules/saml2/constants.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - saml2.constants — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.constants

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-
-
[docs]class OneLogin_Saml2_Constants: - # Value added to the current time in time condition validations - ALOWED_CLOCK_DRIFT = 180 - - # NameID Formats - NAMEID_EMAIL_ADDRESS = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress' - NAMEID_X509_SUBJECT_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName' - NAMEID_WINDOWS_DOMAIN_QUALIFIED_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName' - NAMEID_KERBEROS = 'urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos' - NAMEID_ENTITY = 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity' - NAMEID_TRANSIENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient' - NAMEID_PERSISTENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent' - NAMEID_ENCRYPTED = 'urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted' - - # Attribute Name Formats - ATTRNAME_FORMAT_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified' - ATTRNAME_FORMAT_URI = 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri' - ATTRNAME_FORMAT_BASIC = 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic' - - # Namespaces - NS_SAML = 'urn:oasis:names:tc:SAML:2.0:assertion' - NS_SAMLP = 'urn:oasis:names:tc:SAML:2.0:protocol' - NS_SOAP = 'http://schemas.xmlsoap.org/soap/envelope/' - NS_MD = 'urn:oasis:names:tc:SAML:2.0:metadata' - NS_XS = 'http://www.w3.org/2001/XMLSchema' - NS_XSI = 'http://www.w3.org/2001/XMLSchema-instance' - NS_XENC = 'http://www.w3.org/2001/04/xmlenc#' - NS_DS = 'http://www.w3.org/2000/09/xmldsig#' - - # Bindings - BINDING_HTTP_POST = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' - BINDING_HTTP_REDIRECT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' - BINDING_HTTP_ARTIFACT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact' - BINDING_SOAP = 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP' - BINDING_DEFLATE = 'urn:oasis:names:tc:SAML:2.0:bindings:URL-Encoding:DEFLATE' - - # Auth Context Method - AC_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified' - AC_PASSWORD = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Password' - AC_X509 = 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509' - AC_SMARTCARD = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Smartcard' - AC_KERBEROS = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Kerberos' - - # Subject Confirmation - CM_BEARER = 'urn:oasis:names:tc:SAML:2.0:cm:bearer' - CM_HOLDER_KEY = 'urn:oasis:names:tc:SAML:2.0:cm:holder-of-key' - CM_SENDER_VOUCHES = 'urn:oasis:names:tc:SAML:2.0:cm:sender-vouches' - - # Status Codes - STATUS_SUCCESS = 'urn:oasis:names:tc:SAML:2.0:status:Success' - STATUS_REQUESTER = 'urn:oasis:names:tc:SAML:2.0:status:Requester' - STATUS_RESPONDER = 'urn:oasis:names:tc:SAML:2.0:status:Responder' - STATUS_VERSION_MISMATCH = 'urn:oasis:names:tc:SAML:2.0:status:VersionMismatch' - STATUS_NO_PASSIVE = 'urn:oasis:names:tc:SAML:2.0:status:NoPassive' - STATUS_PARTIAL_LOGOUT = 'urn:oasis:names:tc:SAML:2.0:status:PartialLogout' - STATUS_PROXY_COUNT_EXCEEDED = 'urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded' - - # Crypto - RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1' - - NSMAP = { - 'samlp': NS_SAMLP, - 'saml': NS_SAML, - 'ds': NS_DS, - 'xenc': NS_XENC - }
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/errors.html b/docs/saml2/_modules/saml2/errors.html deleted file mode 100644 index ef958f31..00000000 --- a/docs/saml2/_modules/saml2/errors.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - saml2.errors — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.errors

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-
-
[docs]class OneLogin_Saml2_Error(Exception): - - # Errors - SETTINGS_FILE_NOT_FOUND = 0 - SETTINGS_INVALID_SYNTAX = 1 - SETTINGS_INVALID = 2 - METADATA_SP_INVALID = 3 - SP_CERTS_NOT_FOUND = 4 - REDIRECT_INVALID_URL = 5 - PUBLIC_CERT_FILE_NOT_FOUND = 6 - PRIVATE_KEY_FILE_NOT_FOUND = 7 - SAML_RESPONSE_NOT_FOUND = 8 - SAML_LOGOUTMESSAGE_NOT_FOUND = 9 - SAML_LOGOUTREQUEST_INVALID = 10 - SAML_LOGOUTRESPONSE_INVALID = 11 - SAML_SINGLE_LOGOUT_NOT_SUPPORTED = 12 - - def __init__(self, message, code=0, errors=None): - """ - Initializes the Exception instance. - - Arguments are: - * (str) message. Describes the error. - * (int) code. The code error (defined in the error class). - """ - from saml2.utils import _ - - assert isinstance(message, basestring) - assert isinstance(code, int) - - if errors is not None: - message = message % errors - - Exception.__init__(self, _(message)) - self.code = code
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/logout_request.html b/docs/saml2/_modules/saml2/logout_request.html deleted file mode 100644 index 1b690dd4..00000000 --- a/docs/saml2/_modules/saml2/logout_request.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - - - saml2.logout_request — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.logout_request

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-from base64 import b64decode
-from datetime import datetime
-from lxml import etree
-from os.path import basename
-from urllib import urlencode
-from urlparse import parse_qs
-from xml.dom.minidom import Document, parseString
-
-import dm.xmlsec.binding as xmlsec
-
-from saml2.constants import OneLogin_Saml2_Constants
-from saml2.utils import OneLogin_Saml2_Utils
-
-
-
[docs]class OneLogin_Saml2_Logout_Request: - - def __init__(self, settings,request=None,name_id=None, session_index=None): - """ - Constructs the Logout Request object. - - Arguments are: - * (OneLogin_Saml2_Settings) settings. Setting data - """ - self.__settings = settings - - sp_data = self.__settings.get_sp_data() - idp_data = self.__settings.get_idp_data() - security = self.__settings.get_security_data() - - uid = OneLogin_Saml2_Utils.generate_unique_id() - name_id_value = OneLogin_Saml2_Utils.generate_unique_id() - issue_instant = OneLogin_Saml2_Utils.parse_time_to_SAML(int(datetime.now().strftime("%s"))) - - key = None - if 'nameIdEncrypted' in security and security['nameIdEncrypted']: - key = idp_data['x509cert'] - - name_id = OneLogin_Saml2_Utils.generate_name_id( - name_id_value, - sp_data['entityId'], - sp_data['NameIDFormat'], - key - ) - - logout_request = """<samlp:LogoutRequest - xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" - ID="%(id)s" - Version="2.0" - IssueInstant="%(issue_instant)s" - Destination="%(single_logout_url)s"> - <saml:Issuer>%(entity_id)s</saml:Issuer> - %(name_id)s -</samlp:LogoutRequest>""" % { - 'id': uid, - 'issue_instant': issue_instant, - 'single_logout_url': idp_data['singleLogoutService']['url'], - 'entity_id': sp_data['entityId'], - 'name_id': name_id, - } - - self.__logout_request = logout_request - -
[docs] def get_request(self): - """ - Returns the Logout Request defated, base64encoded - :return: Deflated base64 encoded Logout Request - :rtype: str object - """ - return OneLogin_Saml2_Utils.deflate_and_base64_encode(self.__logout_request) -
- @staticmethod -
[docs] def get_id(request): - """ - Returns the ID of the Logout Request - :param request: Logout Request Message - :type request: string|DOMDocument - :return: string ID - :rtype: str object - """ - if isinstance(request, Document): - dom = request - else: - dom = parseString(request) - return dom.documentElement.getAttribute('ID') -
- @staticmethod -
[docs] def get_name_id_data(request, key=None): - """ - Gets the NameID Data of the the Logout Request - :param request: Logout Request Message - :type request: string|DOMDocument - :param key: The SP key - :type key: string - :return: Name ID Data (Value, Format, NameQualifier, SPNameQualifier) - :rtype: dict - """ - if isinstance(request, Document): - request = request.toxml() - dom = etree.fromstring(request) - name_id = None - - encrypted_entries = OneLogin_Saml2_Utils.query(dom, '/samlp:LogoutRequest/saml:EncryptedID') - - if len(encrypted_entries) == 1: - if key is None: - raise Exception('Key is required in order to decrypt the NameID') - - elem = parseString(etree.tostring(encrypted_entries[0])) - encrypted_data_nodes = elem.documentElement.getElementsByTagName('xenc:EncryptedData') - encrypted_data = encrypted_data_nodes[0] - - xmlsec.initialize() - - # Load the key into the xmlsec context - file_key = OneLogin_Saml2_Utils.write_temp_file(key) # FIXME avoid writing a file - enc_key = xmlsec.Key.load(file_key.name, xmlsec.KeyDataFormatPem, None) - enc_key.name = basename(file_key.name) - file_key.close() - enc_ctx = xmlsec.EncCtx() - enc_ctx.encKey = enc_key - - name_id = OneLogin_Saml2_Utils.decrypt_element(encrypted_data, enc_ctx) - else: - entries = OneLogin_Saml2_Utils.query(dom, '/samlp:LogoutRequest/saml:NameID') - if len(entries) == 1: - name_id = entries[0] - - if name_id is None: - raise Exception('Not NameID found in the Logout Request') - - name_id_data = { - 'Value': name_id.text - } - for attr in ['Format', 'SPNameQualifier', 'NameQualifier']: - if attr in name_id.attrib.keys(): - name_id_data[attr] = name_id.attrib[attr] - - return name_id_data -
- @staticmethod -
[docs] def get_name_id(request, key=None): - """ - Gets the NameID of the Logout Request Message - :param request: Logout Request Message - :type request: string|DOMDocument - :param key: The SP key - :type key: string - :return: Name ID Value - :rtype: string - """ - name_id = OneLogin_Saml2_Logout_Request.get_name_id_data(request, key) - return name_id['Value'] -
- @staticmethod -
[docs] def get_issuer(request): - """ - Gets the Issuer of the Logout Request Message - :param request: Logout Request Message - :type request: string|DOMDocument - :return: The Issuer - :rtype: string - """ - if isinstance(request, Document): - request = request.toxml() - dom = etree.fromstring(request) - - issuer = None - issuer_nodes = OneLogin_Saml2_Utils.query(dom, '/samlp:LogoutRequest/saml:Issuer') - if len(issuer_nodes) == 1: - issuer = issuer_nodes[0].text - return issuer -
- @staticmethod -
[docs] def get_session_indexes(request): - """ - Gets the SessionIndexes from the Logout Request - :param request: Logout Request Message - :type request: string|DOMDocument - :return: The SessionIndex value - :rtype: list - """ - if isinstance(request, Document): - request = request.toxml() - dom = etree.fromstring(request) - - session_indexes = [] - session_index_nodes = OneLogin_Saml2_Utils.query(dom, '/samlp:LogoutRequest/samlp:SessionIndex') - for session_index_node in session_index_nodes: - session_indexes.append(session_index_node.text) - return session_indexes -
- @staticmethod -
[docs] def is_valid(settings, request, get_data, debug=False): - """ - Checks if the Logout Request recieved is valid - :param settings: Settings - :type settings: OneLogin_Saml2_Settings - :param request: Logout Request Message - :type request: string|DOMDocument - :return: If the Logout Request is or not valid - :rtype: boolean - """ - try: - if isinstance(request, Document): - dom = request - else: - dom = parseString(request) - - idp_data = settings.get_idp_data() - idp_entity_id = idp_data['entityId'] - - if settings.is_strict(): - res = OneLogin_Saml2_Utils.validate_xml(dom, 'saml-schema-protocol-2.0.xsd', debug) - if not isinstance(res, Document): - raise Exception('Invalid SAML Logout Request. Not match the saml-schema-protocol-2.0.xsd') - - security = settings.get_security_data() - - current_url = OneLogin_Saml2_Utils.get_self_url_no_query(get_data) - - # Check NotOnOrAfter - if dom.documentElement.hasAttribute('NotOnOrAfter'): - na = OneLogin_Saml2_Utils.parse_SAML_to_time(dom.documentElement.getAttribute('NotOnOrAfter')) - if na <= datetime.now(): - raise Exception('Timing issues (please check your clock settings)') - - # Check destination - if dom.documentElement.hasAttribute('Destination'): - destination = dom.documentElement.getAttribute('Destination') - if destination is not None: - if current_url not in destination: - raise Exception('The LogoutRequest was received at $currentURL instead of $destination') - - # Check issuer - issuer = OneLogin_Saml2_Logout_Request.get_issuer(dom) - if issuer is None or issuer != idp_entity_id: - raise Exception('Invalid issuer in the Logout Request') - - if security['wantMessagesSigned']: - if 'Signature' not in get_data: - raise Exception('The Message of the Logout Request is not signed and the SP require it') - - if 'Signature' in get_data: - if 'SigAlg' not in get_data: - sign_alg = OneLogin_Saml2_Constants.RSA_SHA1 - else: - sign_alg = get_data['SigAlg'] - - if sign_alg != OneLogin_Saml2_Constants.RSA_SHA1: - raise Exception('Invalid signAlg in the recieved Logout Request') - - signed_query = 'SAMLRequest=%s' % urlencode(get_data['SAMLRequest']) - if 'RelayState' in get_data: - signed_query = '%s&RelayState=%s' % (signed_query, urlencode(get_data['RelayState'])) - signed_query = '%s&SigAlg=%s' % (signed_query, urlencode(sign_alg)) - - if 'x509cert' not in idp_data or idp_data['x509cert'] is None: - raise Exception('In order to validate the sign on the Logout Request, the x509cert of the IdP is required') - cert = idp_data['x509cert'] - - xmlsec.initialize() - objkey = xmlsec.Key.load(cert, xmlsec.KeyDataFormatPem, None) # FIXME is this right? - - if not objkey.verifySignature(signed_query, b64decode(get_data['Signature'])): - raise Exception('Signature validation failed. Logout Request rejected') - - return True - except Exception as e: - debug = settings.is_debug_active() - if debug: - print(e.strerror) - return False
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/logout_response.html b/docs/saml2/_modules/saml2/logout_response.html deleted file mode 100644 index 3ea3bbf7..00000000 --- a/docs/saml2/_modules/saml2/logout_response.html +++ /dev/null @@ -1,282 +0,0 @@ - - - - - - - - - - saml2.logout_response — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.logout_response

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-from base64 import b64decode
-from datetime import datetime
-from lxml import etree
-from urllib import quote_plus
-from xml.dom.minidom import Document, parseString
-
-import dm.xmlsec.binding as xmlsec
-
-from saml2.constants import OneLogin_Saml2_Constants
-from saml2.utils import OneLogin_Saml2_Utils
-
-
-
[docs]class OneLogin_Saml2_Logout_Response(): - - def __init__(self, settings, response=None): - """ - Constructs a Logout Response object (Initialize params from settings - and if provided load the Logout Response. - - Arguments are: - * (OneLogin_Saml2_Settings) settings. Setting data - * (string) response. An UUEncoded SAML Logout - response from the IdP. - """ - self.__settings = settings - if response is not None: - self.__logout_response = OneLogin_Saml2_Utils.decode_base64_and_inflate(response) - self.document = parseString(self.__logout_response) - -
[docs] def get_issuer(self): - """ - Gets the Issuer of the Logout Response Message - :return: The Issuer - :rtype: string - """ - issuer = None - issuer_nodes = self.__query('/samlp:LogoutResponse/saml:Issuer') - if len(issuer_nodes) == 1: - issuer = issuer_nodes[0].text - return issuer -
-
[docs] def get_status(self): - """ - Gets the Status - :return: The Status - :rtype: string - """ - entries = self.__query('/samlp:LogoutResponse/samlp:Status/samlp:StatusCode') - if len(entries) == 0: - return None - status = entries[0].attrib['Value'] - return status -
-
[docs] def is_valid(self, request_data, request_id=None): - """ - Determines if the SAML LogoutResponse is valid - :param request_id: The ID of the LogoutRequest sent by this SP to the IdP - :type request_id: string - :return: Returns if the SAML LogoutResponse is or not valid - :rtype: boolean - """ - try: - idp_data = self.__settings.get_idp_data() - idp_entity_id = idp_data['entityId'] - get_data = request_data['get_data'] - - if self.__settings.is_strict(): - res = OneLogin_Saml2_Utils.validate_xml(self.document, 'saml-schema-protocol-2.0.xsd', self.__settings.is_debug_active()) - if not isinstance(res, Document): - raise Exception('Invalid SAML Logout Request. Not match the saml-schema-protocol-2.0.xsd') - - security = self.__settings.get_security_data() - - # Check if the InResponseTo of the Logout Response matchs the ID of the Logout Request (requestId) if provided - if request_id is not None and self.document.documentElement.hasAttribute('InResponseTo'): - in_response_to = self.document.documentElement.getAttribute('InResponseTo') - if request_id != in_response_to: - raise Exception('The InResponseTo of the Logout Response: %s, does not match the ID of the Logout request sent by the SP: %s' % (in_response_to, request_id)) - - # Check issuer - issuer = self.get_issuer() - if issuer is None or issuer != idp_entity_id: - raise Exception('Invalid issuer in the Logout Request') - - current_url = OneLogin_Saml2_Utils.get_self_url_no_query(request_data) - - # Check destination - if self.document.documentElement.hasAttribute('Destination'): - destination = self.document.documentElement.getAttribute('Destination') - if destination is not None: - if current_url not in destination: - raise Exception('The LogoutRequest was received at $currentURL instead of $destination') - - if security['wantMessagesSigned']: - if 'Signature' not in get_data: - raise Exception('The Message of the Logout Response is not signed and the SP require it') - - if 'Signature' in get_data: - if 'SigAlg' not in get_data: - sign_alg = OneLogin_Saml2_Constants.RSA_SHA1 - else: - sign_alg = get_data['SigAlg'] - - if sign_alg != OneLogin_Saml2_Constants.RSA_SHA1: - raise Exception('Invalid signAlg in the recieved Logout Response') - - signed_query = 'SAMLResponse=%s' % quote_plus(get_data['SAMLResponse']) - if 'RelayState' in get_data: - signed_query = '%s&RelayState=%s' % (signed_query, quote_plus(get_data['RelayState'])) - signed_query = '%s&SigAlg=%s' % (signed_query, quote_plus(sign_alg)) - - if 'x509cert' not in idp_data or idp_data['x509cert'] is None: - raise Exception('In order to validate the sign on the Logout Response, the x509cert of the IdP is required') - cert = idp_data['x509cert'] - - xmlsec.initialize() - objkey = xmlsec.Key.load(cert, xmlsec.KeyDataFormatPem, None) # FIXME is this right? - - if not objkey.verifySignature(signed_query, b64decode(get_data['Signature'])): - raise Exception('Signature validation failed. Logout Response rejected') - - return True - except Exception as e: - debug = self.__settings.is_debug_active() - if debug: - print(e.strerror) - return False -
- def __query(self, query): - """ - Extracts a node from the DOMDocument (Logout Response Menssage) - :param query: Xpath Expresion - :type query: string - :return: The queried node - :rtype: DOMNodeList - """ - # Switch to lxml for querying - xml = self.document.toxml() - return OneLogin_Saml2_Utils.query(etree.fromstring(xml), query) - -
[docs] def build(self, in_response_to): - """ - Creates a Logout Response object. - :param in_response_to: InResponseTo value for the Logout Response. - :type in_response_to: string - """ - sp_data = self.__settings.get_sp_data() - idp_data = self.__settings.get_idp_data() - - uid = OneLogin_Saml2_Utils.generate_unique_id() - issue_instant = OneLogin_Saml2_Utils.parse_time_to_SAML( - int(datetime.now().strftime("%s")) - ) - - logout_response = """<samlp:LogoutResponse xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" - ID="%(id)s" - Version="2.0" - IssueInstant="%(issue_instant)s" - Destination="%(destination)s" - InResponseTo="%(in_response_to)s" -> - <saml:Issuer>%(entity_id)s</saml:Issuer> - <samlp:Status> - <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" /> - </samlp:Status> -</samlp:LogoutResponse>""" % { - 'id': uid, - 'issue_instant': issue_instant, - 'destination': idp_data['singleLogoutService']['url'], - 'in_response_to': in_response_to, - 'entity_id': sp_data['entityId'], - } - - self.__logout_response = logout_response -
-
[docs] def get_response(self): - """ - Returns a Logout Response object. - :return: Logout Response deflated and base64 encoded - :rtype: string - """ - return OneLogin_Saml2_Utils.deflate_and_base64_encode(self.__logout_response)
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/metadata.html b/docs/saml2/_modules/saml2/metadata.html deleted file mode 100644 index 7b0a1be5..00000000 --- a/docs/saml2/_modules/saml2/metadata.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - saml2.metadata — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.metadata

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-from time import gmtime, strftime
-from datetime import datetime
-from xml.dom.minidom import parseString
-
-from saml2.constants import OneLogin_Saml2_Constants
-from saml2.utils import OneLogin_Saml2_Utils
-
-
-
[docs]class OneLogin_Saml2_Metadata: - - TIME_VALID = 172800 # 2 days - TIME_CACHED = 604800 # 1 week - - @staticmethod -
[docs] def builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=None, contacts=None, organization=None): - """ - Build the metadata of the SP - - :param sp: The SP data - :type sp: string - - :param authnsign: authnRequestsSigned attribute - :type authnsign: string - - :param wsign: wantAssertionsSigned attribute - :type wsign: string - - :param valid_until: Metadata's valid time - :type valid_until: DateTime - - :param cache_duration: Duration of the cache in seconds - :type cache_duration: Timestamp - - :param contacts: Contacts info - :type contacts: dict - - :param organization: Organization ingo - :type organization: dict - """ - if valid_until is None: - valid_until = int(datetime.now().strftime("%s")) + OneLogin_Saml2_Metadata.TIME_VALID - valid_until_time = gmtime(valid_until) - valid_until_time = strftime(r'%Y-%m-%dT%H:%M:%SZ', valid_until_time) - if cache_duration is None: - cache_duration = int(datetime.now().strftime("%s")) + OneLogin_Saml2_Metadata.TIME_CACHED - if contacts is None: - contacts = {} - if organization is None: - organization = {} - - sls = '' - if 'singleLogoutService' in sp: - sls = """<md:SingleLogoutService Binding="%(binding)s" - Location="%(location)s" />""" % { - 'binding': sp['singleLogoutService']['binding'], - 'location': sp['singleLogoutService']['url'], - } - - str_authnsign = 'true' if authnsign else 'false' - str_wsign = 'true' if wsign else 'false' - - str_organization = '' - if len(organization) > 0: - organization_info = [] - for (lang, info) in organization.items(): - organization_info.append(""" <md:Organization> - <md:OrganizationName xml:lang="%(lang)s">%(name)s</md:OrganizationName> - <md:OrganizationDisplayName xml:lang="%(lang)s">%(display_name)s</md:OrganizationDisplayName> - <md:OrganizationURL xml:lang="%(lang)s">%(url)s</md:OrganizationURL> - </md:Organization>""" % { - 'lang': lang, - 'name': info['name'], - 'display_name': info['displayname'], - 'url': info['url'], - }) - str_organization = '\n'.join(organization_info) - - str_contacts = '' - if len(contacts) > 0: - contacts_info = [] - for (ctype, info) in contacts.items(): - contacts_info.append(""" <md:ContactPerson contactType="%(type)s"> - <md:GivenName>%(name)s</md:GivenName> - <md:EmailAddress>%(email)s</md:EmailAddress> - </md:ContactPerson>""" % { - 'type': ctype, - 'name': info['givenName'], - 'email': info['emailAddress'], - }) - str_contacts = '\n'.join(contacts_info) - - metadata = """<?xml version="1.0"?> -<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" - validUntil="%(valid)s" - cacheDuration="PT%(cache)sS" - entityID="%(entity_id)s"> - <md:SPSSODescriptor AuthnRequestsSigned="%(authnsign)s" WantAssertionsSigned="%(wsign)s" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> - <md:NameIDFormat>%(name_id_format)s</md:NameIDFormat> - <md:AssertionConsumerService Binding="%(binding)s" - Location="%(location)s" - index="1" /> -%(sls)s - </md:SPSSODescriptor> -%(organization)s -%(contacts)s -</md:EntityDescriptor>""" % { - 'valid': valid_until_time, - 'cache': cache_duration, - 'entity_id': sp['entityId'], - 'authnsign': str_authnsign, - 'wsign': str_wsign, - 'name_id_format': sp['NameIDFormat'], - 'binding': sp['assertionConsumerService']['binding'], - 'location': sp['assertionConsumerService']['url'], - 'sls': sls, - 'organization': str_organization, - 'contacts': str_contacts, - } - - return metadata -
- @staticmethod -
[docs] def sign_metadata(metadata, key, cert): - """ - Sign the metadata with the key/cert provided - - :param metadata: SAML Metadata XML - :type metadata: string - - :param key: x509 key - :type key: string - - :param cert: x509 cert - :type cert: string - - :returns: Signed Metadata - :rtype: string - """ - return OneLogin_Saml2_Utils.add_sign(metadata, key, cert) -
- @staticmethod -
[docs] def add_x509_key_descriptors(metadata, cert): - """ - Add the x509 descriptors (sign/encriptation to the metadata - The same cert will be used for sign/encrypt - - :param metadata: SAML Metadata XML - :type metadata: string - - :param cert: x509 cert - :type cert: string - - :returns: Metadata with KeyDescriptors - :rtype: string - """ - try: - xml = parseString(metadata) - except Exception as e: - raise Exception('Error parsing metadata. ' + e.message) - - formated_cert = OneLogin_Saml2_Utils.format_cert(cert, False) - x509_certificate = xml.createElementNS(OneLogin_Saml2_Constants.NS_DS, 'ds:X509Certificate') - content = xml.createTextNode(formated_cert) - x509_certificate.appendChild(content) - - key_data = xml.createElementNS(OneLogin_Saml2_Constants.NS_DS, 'ds:X509Data') - key_data.appendChild(x509_certificate) - - key_info = xml.createElementNS(OneLogin_Saml2_Constants.NS_DS, 'ds:KeyInfo') - key_info.appendChild(key_data) - - key_descriptor = xml.createElementNS(OneLogin_Saml2_Constants.NS_DS, 'md:KeyDescriptor') - - entity_descriptor = sp_sso_descriptor = xml.getElementsByTagName('md:EntityDescriptor')[0] - entity_descriptor.setAttribute('xmlns:ds', OneLogin_Saml2_Constants.NS_DS) - - sp_sso_descriptor = xml.getElementsByTagName('md:SPSSODescriptor')[0] - sp_sso_descriptor.insertBefore(key_descriptor.cloneNode(True), sp_sso_descriptor.firstChild) - sp_sso_descriptor.insertBefore(key_descriptor.cloneNode(True), sp_sso_descriptor.firstChild) - - signing = xml.getElementsByTagName('md:KeyDescriptor')[0] - signing.setAttribute('use', 'signing') - - encryption = xml.getElementsByTagName('md:KeyDescriptor')[1] - encryption.setAttribute('use', 'encryption') - - signing.appendChild(key_info) - encryption.appendChild(key_info.cloneNode(True)) - - return xml.toxml()
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/response.html b/docs/saml2/_modules/saml2/response.html deleted file mode 100644 index d3fee4e3..00000000 --- a/docs/saml2/_modules/saml2/response.html +++ /dev/null @@ -1,532 +0,0 @@ - - - - - - - - - - saml2.response — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.response

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-from base64 import b64decode
-from copy import deepcopy
-from lxml import etree
-from os.path import basename
-from time import time
-import sys
-from xml.dom.minidom import Document
-
-import dm.xmlsec.binding as xmlsec
-
-from saml2.constants import OneLogin_Saml2_Constants
-from saml2.utils import OneLogin_Saml2_Utils
-
-
-
[docs]class OneLogin_Saml2_Response(object): - - def __init__(self, settings, response): - """ - Constructs the response object. - - :param settings: The setting info - :type settings: OneLogin_Saml2_Setting object - - :param response: The base64 encoded, XML string containing the samlp:Response - :type response: string - """ - self.__settings = settings - self.response = b64decode(response) - self.document = etree.fromstring(self.response) - self.decrypted_document = None - self.encrypted = None - - # Quick check for the presence of EncryptedAssertion - encrypted_assertion_nodes = self.__query('//saml:EncryptedAssertion') - if encrypted_assertion_nodes: - decrypted_document = deepcopy(self.document) - self.encrypted = True - self.decrypted_document = self.__decrypt_assertion(decrypted_document) - -
[docs] def is_valid(self, request_data, request_id=None): - """ - Constructs the response object. - - :param request_id: Optional argument. The ID of the AuthNRequest sent by this SP to the IdP - :type request_id: string - - :returns: True if the SAML Response is valid, False if not - :rtype: bool - """ - try: - # Checks SAML version - if self.document.get('Version', None) != '2.0': - raise Exception('Unsupported SAML version') - - # Checks that ID exists - if self.document.get('ID', None) is None: - raise Exception('Missing ID attribute on SAML Response') - - # Checks that the response only has one assertion - if not self.validate_num_assertions(): - raise Exception('Multiple assertions are not supported') - - # Checks that the response has the SUCCESS status - self.check_status() - - idp_data = self.__settings.get_idp_data() - idp_entityid = idp_data.get('entityId', '') - sp_data = self.__settings.get_sp_data() - sp_entityid = sp_data.get('entityId', '') - - sign_nodes = self.__query('//ds:Signature') - - signed_elements = [] - for sign_node in sign_nodes: - signed_elements.append(sign_node.getparent().tag) - - if self.__settings.is_strict(): - res = OneLogin_Saml2_Utils.validate_xml(etree.tostring(self.document), 'saml-schema-protocol-2.0.xsd', self.__settings.is_debug_active()) - if not isinstance(res, Document): - raise Exception('Invalid SAML Response. Not match the saml-schema-protocol-2.0.xsd') - - security = self.__settings.get_security_data() - current_url = OneLogin_Saml2_Utils.get_self_url_no_query(request_data) - - # Check if the InResponseTo of the Response matchs the ID of the AuthNRequest (requestId) if provided - in_response_to = self.document.get('InResponseTo', None) - if in_response_to and request_id: - if in_response_to != request_id: - raise Exception('The InResponseTo of the Response: %s, does not match the ID of the AuthNRequest sent by the SP: %s' % (in_response_to, request_id)) - - if not self.encrypted and security.get('wantAssertionsEncrypted', False): - raise Exception('The assertion of the Response is not encrypted and the SP require it') - - if security.get('wantNameIdEncrypted', False): - encrypted_nameid_nodes = self.__query_assertion('/saml:Subject/saml:EncryptedID/xenc:EncryptedData') - if not encrypted_nameid_nodes: - raise Exception('The NameID of the Response is not encrypted and the SP require it') - - # Checks that there is at least one AttributeStatement - attribute_statement_nodes = self.__query_assertion('/saml:AttributeStatement') - if not attribute_statement_nodes: - raise Exception('There is no AttributeStatement on the Response') - - # Validates Asserion timestamps - if not self.validate_timestamps(): - raise Exception('Timing issues (please check your clock settings)') - - encrypted_attributes_nodes = self.__query_assertion('/saml:AttributeStatement/saml:EncryptedAttribute') - if encrypted_attributes_nodes: - raise Exception('There is an EncryptedAttribute in the Response and this SP not support them') - - # Checks destination - destination = self.document.get('Destination', None) - if destination: - if destination not in current_url: - raise Exception('The response was received at %s instead of %s' % (current_url, destination)) - - # Checks audience - valid_audiences = self.get_audiences() - if valid_audiences and sp_entityid not in valid_audiences: - raise Exception('%s is not a valid audience for this Response' % sp_entityid) - - # Checks the issuers - issuers = self.get_issuers() - for issuer in issuers: - if not issuer or issuer != idp_entityid: - raise Exception('Invalid issuer in the Assertion/Response') - - # Checks the session Expiration - session_expiration = self.get_session_not_on_or_after() - if not session_expiration and session_expiration <= time(): - raise Exception('The attributes have expired, based on the SessionNotOnOrAfter of the AttributeStatement of this Response') - - # Checks the SubjectConfirmation, at least one SubjectConfirmation must be valid - any_subject_confirmation = False - subject_confirmation_nodes = self.__query_assertion('/saml:Subject/saml:SubjectConfirmation') - - for scn in subject_confirmation_nodes: - method = scn.get('Method', None) - if method and method != OneLogin_Saml2_Constants.CM_BEARER: - continue - scData = scn.find('saml:SubjectConfirmationData', namespaces=OneLogin_Saml2_Constants.NSMAP) - if scData is None: - continue - else: - irt = scData.get('InResponseTo', None) - if irt != in_response_to: - continue - recipient = scData.get('Recipient', None) - if recipient not in current_url: - continue - nooa = scData.get('NotOnOrAfter', None) - if nooa: - parsed_nooa = OneLogin_Saml2_Utils.parse_SAML_to_time(nooa) - if parsed_nooa <= time(): - continue - nb = scData.get('NotBefore', None) - if nb: - parsed_nb = OneLogin_Saml2_Utils.parse_SAML_to_time(nb) - if (parsed_nb > time()): - continue - any_subject_confirmation = True - break - - if not any_subject_confirmation: - raise Exception('A valid SubjectConfirmation was not found on this Response') - - if security.get('wantAssertionsSigned', False) and 'saml:Assertion' not in signed_elements: - raise Exception('The Assertion of the Response is not signed and the SP require it') - - if security.get('wantMessagesSigned', False) and 'samlp:Response' not in signed_elements: - raise Exception('The Message of the Response is not signed and the SP require it') - - document_to_validate = None - if len(signed_elements) > 0: - cert = idp_data.get('x509cert', None) - fingerprint = idp_data.get('certFingerprint', None) - - # Only validates the first sign found - if 'samlp:Response' in signed_elements: - document_to_validate = self.document - else: - if self.encrypted: - document_to_validate = self.decrypted_document - else: - document_to_validate = self.document - - if document_to_validate is not None: - if not OneLogin_Saml2_Utils.validate_sign(document_to_validate, cert, fingerprint): - raise Exception('Signature validation failed. SAML Response rejected') - return True - except: - debug = self.__settings.is_debug_active() - if debug: - print sys.exc_info()[0] - return False -
-
[docs] def check_status(self): - """ - Check if the status of the response is success or not - - :raises: Exception. If the status is not success - """ - status = OneLogin_Saml2_Utils.get_status(self.document) - code = status.get('code', None) - if code and code != OneLogin_Saml2_Constants.STATUS_SUCCESS: - splited_code = code.split(':') - printable_code = splited_code.pop() - status_exception_msg = 'The status code of the Response was not Success, was %s' % printable_code - status_msg = status.get('msg', None) - if status_msg: - status_exception_msg += ' -> ' + status_msg - raise Exception(status_exception_msg) -
-
[docs] def get_audiences(self): - """ - Gets the audiences - - :returns: The valid audiences for the SAML Response - :rtype: list - """ - audiences = [] - - audience_nodes = self.__query_assertion('/saml:Conditions/saml:AudienceRestriction/saml:Audience') - for audience_node in audience_nodes: - audiences.append(audience_node.text) -
-
[docs] def get_issuers(self): - """ - Gets the issuers (from message and from assertion) - - :returns: The issuers - :rtype: list - """ - issuers = [] - - message_issuer_nodes = self.__query('/samlp:Response/saml:Issuer') - if message_issuer_nodes: - issuers.append(message_issuer_nodes[0].text) - - assertion_issuer_nodes = self.__query_assertion('/saml:Issuer') - if assertion_issuer_nodes: - issuers.append(assertion_issuer_nodes[0].text) - - return list(set(issuers)) -
-
[docs] def get_nameid_data(self): - """ - Gets the NameID Data provided by the SAML Response from the IdP - - :returns: Name ID Data (Value, Format, NameQualifier, SPNameQualifier) - :rtype: dict - """ - nameid = None - encrypted_id_data_nodes = self.__query_assertion('/saml:Subject/saml:EncryptedID/xenc:EncryptedData') - if encrypted_id_data_nodes: - encrypted_data = encrypted_id_data_nodes[0] - - xmlsec.initialize() - - # Load the key into the xmlsec context - key = self.__settings.get_sp_key() - file_key = OneLogin_Saml2_Utils.write_temp_file(key) # FIXME avoid writing a file - enc_key = xmlsec.Key.load(file_key.name, xmlsec.KeyDataFormatPem, None) - enc_key.name = basename(file_key.name) - file_key.close() - enc_ctx = xmlsec.EncCtx() - enc_ctx.encKey = enc_key - - nameid = OneLogin_Saml2_Utils.decrypt_element(encrypted_data, enc_ctx) - else: - nameid_nodes = self.__query_assertion('/saml:Subject/saml:NameID') - if nameid_nodes: - nameid = nameid_nodes[0] - if nameid is None: - raise Exception('Not NameID found in the assertion of the Response') - - nameid_data = {'Value': nameid.text} - for attr in ['Format', 'SPNameQualifier', 'NameQualifier']: - value = nameid.get(attr, None) - if value: - nameid_data[attr] = value - return nameid_data -
-
[docs] def get_nameid(self): - """ - Gets the NameID provided by the SAML Response from the IdP - - :returns: NameID (value) - :rtype: string - """ - nameid_data = self.get_nameid_data() - return nameid_data['Value'] -
-
[docs] def get_session_not_on_or_after(self): - """ - Gets the SessionNotOnOrAfter from the AuthnStatement - Could be used to set the local session expiration - - :returns: The SessionNotOnOrAfter value - :rtype: time|None - """ - not_on_or_after = None - authn_statement_nodes = self.__query_assertion('/saml:AuthnStatement[@SessionNotOnOrAfter]') - if authn_statement_nodes: - not_on_or_after = OneLogin_Saml2_Utils.parse_SAML_to_time(authn_statement_nodes[0].get('SessionNotOnOrAfter')) - return not_on_or_after -
-
[docs] def get_session_index(self): - """ - Gets the SessionIndex from the AuthnStatement - Could be used to be stored in the local session in order - to be used in a future Logout Request that the SP could - send to the SP, to set what specific session must be deleted - - :returns: The SessionIndex value - :rtype: string|None - """ - session_index = None - authn_statement_nodes = self.__query_assertion('/saml:AuthnStatement[@SessionIndex]') - if authn_statement_nodes: - session_index = authn_statement_nodes[0].get('SessionIndex') - return session_index -
-
[docs] def get_attributes(self): - """ - Gets the Attributes from the AttributeStatement element. - EncryptedAttributes are not supported - """ - attributes = {} - attribute_nodes = self.__query_assertion('/saml:AttributeStatement/saml:Attribute') - for attribute_node in attribute_nodes: - attr_name = attribute_node.get('Name') - values = [] - for attr in attribute_node.iterchildren('{%s}AttributeValue' % OneLogin_Saml2_Constants.NSMAP['saml']): - values.append(attr.text) - attributes[attr_name] = values - return attributes -
-
[docs] def validate_num_assertions(self): - """ - Verifies that the document only contains a single Assertion (encrypted or not) - - :returns: True if only 1 assertion encrypted or not - :rtype: bool - """ - encrypted_assertion_nodes = self.__query('//saml:EncryptedAssertion') - assertion_nodes = self.__query('//saml:Assertion') - return (len(encrypted_assertion_nodes) + len(assertion_nodes)) == 1 -
-
[docs] def validate_timestamps(self): - """ - Verifies that the document is valid according to Conditions Element - - :returns: True if the condition is valid, False otherwise - :rtype: bool - """ - conditions_nodes = self.__query('//saml:Conditions') - for conditions_node in conditions_nodes: - nb_attr = conditions_node.get('NotBefore') - nooa_attr = conditions_node.get('NotOnOrAfter') - if nb_attr and OneLogin_Saml2_Utils.parse_SAML_to_time(nb_attr) > time() + OneLogin_Saml2_Constants.ALOWED_CLOCK_DRIFT: - return False - if nooa_attr and OneLogin_Saml2_Utils.parse_SAML_to_time(nooa_attr) + OneLogin_Saml2_Constants.ALOWED_CLOCK_DRIFT <= time(): - return False - return True -
- def __query_assertion(self, xpath_expr): - """ - Extracts nodes that match the query from the Assertion - - :param query: Xpath Expresion - :type query: String - - :returns: The queried nodes - :rtype: list - """ - if self.encrypted: - assertion_expr = '/saml:EncryptedAssertion/saml:Assertion' - else: - assertion_expr = '/saml:Assertion' - signature_expr = '/ds:Signature/ds:SignedInfo/ds:Reference' - signed_assertion_query = '/samlp:Response' + assertion_expr + signature_expr - assertion_reference_nodes = self.__query(signed_assertion_query) - - if not assertion_reference_nodes: - # Check if the message is signed - signed_message_query = '/samlp:Response' + signature_expr - message_reference_nodes = self.__query(signed_message_query) - if message_reference_nodes: - id = message_reference_nodes[0].get('URI') - final_query = "/samlp:Response[@ID='%s']/" % id[1:] - else: - final_query = "/samlp:Response/" - final_query += assertion_expr - else: - id = assertion_reference_nodes[0].get('URI') - final_query = '/samlp:Response' + assertion_expr + "[@ID='%s']" % id[1:] - final_query += xpath_expr - return self.__query(final_query) - - def __query(self, query): - """ - Extracts nodes that match the query from the Response - - :param query: Xpath Expresion - :type query: String - - :returns: The queried nodes - :rtype: list - """ - if self.encrypted: - document = self.decrypted_document - else: - document = self.document - return OneLogin_Saml2_Utils.query(document, query) - - def __decrypt_assertion(self, dom): - """ - Decrypts the Assertion - - :raises: Exception if no private key available - :param dom: Encrypted Assertion - :type dom: Element - :returns: Decrypted Assertion - :rtype: Element - """ - key = self.__settings.get_sp_key() - - if not key: - raise Exception('No private key available, check settings') - - # TODO Study how decrypt assertion
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_modules/saml2/settings.html b/docs/saml2/_modules/saml2/settings.html deleted file mode 100644 index 5f8f5c2c..00000000 --- a/docs/saml2/_modules/saml2/settings.html +++ /dev/null @@ -1,695 +0,0 @@ - - - - - - - - - - saml2.settings — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.settings

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-from datetime import datetime
-import json
-import re
-from os.path import dirname, exists, join, sep
-from xml.dom.minidom import Document
-
-from saml2.constants import OneLogin_Saml2_Constants
-from saml2.errors import OneLogin_Saml2_Error
-from saml2.metadata import OneLogin_Saml2_Metadata
-from saml2.utils import OneLogin_Saml2_Utils
-
-
-# Regex from Django Software Foundation and individual contributors.
-# Released under a BSD 3-Clause License
-url_regex = re.compile(
-    r'^(?:[a-z0-9\.\-]*)://'  # scheme is validated separately
-    r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|'  # domain...
-    r'localhost|'  # localhost...
-    r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|'  # ...or ipv4
-    r'\[?[A-F0-9]*:[A-F0-9:]+\]?)'  # ...or ipv6
-    r'(?::\d+)?'  # optional port
-    r'(?:/?|[/?]\S+)$', re.IGNORECASE)
-url_schemes = ['http', 'https', 'ftp', 'ftps']
-
-
-
[docs]def validate_url(url): - scheme = url.split('://')[0].lower() - if scheme not in url_schemes: - return False - if not bool(url_regex.search(url)): - return False - return True - -
-
[docs]class OneLogin_Saml2_Settings: - - def __init__(self, settings=None, custom_base_path=None): - """ - Initializes the settings: - - Sets the paths of the different folders - - Loads settings info from settings file or array/object provided - - :param settings: SAML Toolkit Settings - :type settings: dict|object - """ - self.__paths = {} - self.__strict = False - self.__debug = False - self.__sp = {} - self.__idp = {} - self.__contacts = {} - self.__organization = {} - self.__errors = [] - - self.__load_paths(base_path=custom_base_path) - self.__update_paths(settings) - - if settings is None: - if not self.__load_settings_from_file(): - raise OneLogin_Saml2_Error( - 'Invalid file settings: %s', - OneLogin_Saml2_Error.SETTINGS_INVALID, - ','.join(self.__errors) - ) - self.__add_default_values() - elif isinstance(settings, dict): - if not self.__load_settings_from_dict(settings): - raise OneLogin_Saml2_Error( - 'Invalid dict settings: %s', - OneLogin_Saml2_Error.SETTINGS_INVALID, - ','.join(self.__errors) - ) - else: - raise Exception('Unsupported settings object') - - self.format_idp_cert() - - def __load_paths(self, base_path=None): - """ - Sets the paths of the different folders - """ - if base_path is None: - base_path = dirname(dirname(dirname(__file__))) - base_path += sep - self.__paths = { - 'base': base_path, - 'cert': base_path + 'certs' + sep, - 'lib': base_path + 'lib' + sep, - 'extlib': base_path + 'extlib' + sep, - } - - def __update_paths(self, settings): - """ - Set custom paths if necessary - """ - if not isinstance(settings, dict): - return - - if 'custom_base_path' in settings: - base_path = settings['custom_base_path'] - base_path = join(dirname(__file__), base_path) - self.__load_paths(base_path) - -
[docs] def get_base_path(self): - """ - Returns base path - - :return: The base toolkit folder path - :rtype: string - """ - return self.__paths['base'] -
-
[docs] def get_cert_path(self): - """ - Returns cert path - - :return: The cert folder path - :rtype: string - """ - return self.__paths['cert'] -
-
[docs] def get_lib_path(self): - """ - Returns lib path - - :return: The library folder path - :rtype: string - """ - return self.__paths['lib'] -
-
[docs] def get_ext_lib_path(self): - """ - Returns external lib path - - :return: The external library folder path - :rtype: string - """ - return self.__paths['extlib'] -
-
[docs] def get_schemas_path(self): - """ - Returns schema path - - :return: The schema folder path - :rtype: string - """ - return self.__paths['lib'] + 'schemas/' -
- def __load_settings_from_dict(self, settings): - """ - Loads settings info from a settings Dict - - :param settings: SAML Toolkit Settings - :type settings: dict - - :returns: True if the settings info is valid - :rtype: boolean - """ - errors = self.check_settings(settings) - if len(errors) == 0: - self.__errors = [] - self.__sp = settings['sp'] - self.__idp = settings['idp'] - - if 'strict' in settings: - self.__strict = settings['strict'] - if 'debug' in settings: - self.__debug = settings['debug'] - if 'security' in settings: - self.__security = settings['security'] - if 'contactPerson' in settings: - self.__contacts = settings['contactPerson'] - if 'organization' in settings: - self.__organization = settings['organization'] - - self.__add_default_values() - return True - - self.__errors = errors - return False - - def __load_settings_from_file(self): - """ - Loads settings info from the settings json file - - :returns: True if the settings info is valid - :rtype: boolean - """ - filename = self.get_base_path() + 'settings.json' - - if not exists(filename): - raise OneLogin_Saml2_Error( - 'Settings file not found: %s', - OneLogin_Saml2_Error.SETTINGS_FILE_NOT_FOUND, - filename - ) - - # In the php toolkit instead of being a json file it is a php file and - # it is directly included - json_data = open(filename, 'r') - settings = json.load(json_data) - json_data.close() - - advanced_filename = self.get_base_path() + 'advanced_settings.json' - if exists(advanced_filename): - json_data = open(advanced_filename, 'r') - settings.update(json.load(json_data)) # Merge settings - json_data.close() - - return self.__load_settings_from_dict(settings) - - def __add_default_values(self): - """ - Add default values if the settings info is not complete - """ - if 'binding' not in self.__sp['assertionConsumerService']: - self.__sp['assertionConsumerService']['binding'] = OneLogin_Saml2_Constants.BINDING_HTTP_POST - if 'singleLogoutService' in self.__sp and 'binding' not in self.__sp['singleLogoutService']: - self.__sp['singleLogoutService']['binding'] = OneLogin_Saml2_Constants.BINDING_HTTP_REDIRECT - - # Related to nameID - if 'NameIDFormat' not in self.__sp: - self.__sp['NameIDFormat'] = OneLogin_Saml2_Constants.NAMEID_PERSISTENT - if 'nameIdEncrypted' not in self.__security: - self.__security['nameIdEncrypted'] = False - - # Sign provided - if 'authnRequestsSigned' not in self.__security: - self.__security['authnRequestsSigned'] = False - if 'logoutRequestSigned' not in self.__security: - self.__security['logoutRequestSigned'] = False - if 'logoutResponseSigned' not in self.__security: - self.__security['logoutResponseSigned'] = False - if 'signMetadata' not in self.__security: - self.__security['signMetadata'] = False - - # Sign expected - if 'wantMessagesSigned' not in self.__security: - self.__security['wantMessagesSigned'] = False - if 'wantAssertionsSigned' not in self.__security: - self.__security['wantAssertionsSigned'] = False - - # Encrypt expected - if 'wantAssertionsEncrypted' not in self.__security: - self.__security['wantAssertionsEncrypted'] = False - if 'wantNameIdEncrypted' not in self.__security: - self.__security['wantNameIdEncrypted'] = False - - if 'x509cert' not in self.__idp: - self.__idp['x509cert'] = '' - if 'certFingerprint' not in self.__idp: - self.__idp['certFingerprint'] = '' - -
[docs] def check_settings(self, settings): - """ - Checks the settings info. - - :param settings: Dict with settings data - :type settings: dict - - :returns: Errors found on the settings data - :rtype: list - """ - assert isinstance(settings, dict) - - errors = [] - if not isinstance(settings, dict) or len(settings) == 0: - errors.append('invalid_syntax') - return errors - - if 'idp' not in settings or len(settings['idp']) == 0: - errors.append('idp_not_found') - else: - idp = settings['idp'] - if 'entityId' not in idp or len(idp['entityId']) == 0: - errors.append('idp_entityId_not_found') - - if ('singleSignOnService' not in idp or - 'url' not in idp['singleSignOnService'] or - len(idp['singleSignOnService']['url']) == 0): - errors.append('idp_sso_not_found') - elif not validate_url(idp['singleSignOnService']['url']): - errors.append('idp_sso_url_invalid') - - if ('singleLogoutService' in idp and - 'url' in idp['singleLogoutService'] and - len(idp['singleLogoutService']['url']) > 0 and - not validate_url(idp['singleLogoutService']['url'])): - errors.append('idp_slo_url_invalid') - - if 'sp' not in settings or len(settings['sp']) == 0: - errors.append('sp_not_found') - else: - sp = settings['sp'] - security = {} - if 'security' in settings: - security = settings['security'] - - if 'entityId' not in sp or len(sp['entityId']) == 0: - errors.append('sp_entityId_not_found') - - if ('assertionConsumerService' not in sp or - 'url' not in sp['assertionConsumerService'] or - len(sp['assertionConsumerService']['url']) == 0): - errors.append('sp_acs_not_found') - elif not validate_url(sp['assertionConsumerService']['url']): - errors.append('sp_acs_url_invalid') - - if ('singleLogoutService' in sp and - 'url' in sp['singleLogoutService'] and - len(sp['singleLogoutService']['url']) > 0 and - not validate_url(sp['singleLogoutService']['url'])): - errors.append('sp_sls_url_invalid') - - if 'signMetadata' in security and isinstance(security['signMetadata'], dict): - if ('keyFileName' not in security['signMetadata'] or - 'certFileName' not in security['signMetadata']): - errors.append('sp_signMetadata_invalid') - - if ((('authnRequestsSigned' in security and security['authnRequestsSigned']) or - ('logoutRequestSigned' in security and security['logoutRequestSigned']) or - ('logoutResponseSigned' in security and security['logoutResponseSigned']) or - ('wantAssertionsEncrypted' in security and security['wantAssertionsEncrypted']) or - ('wantNameIdEncrypted' in security and security['wantNameIdEncrypted'])) and - not self.check_sp_certs()): - errors.append('sp_cert_not_found_and_required') - - exists_X509 = ('idp' in settings and - 'x509cert' in settings['idp'] and - len(settings['idp']['x509cert']) > 0) - exists_fingerprint = ('idp' in settings and - 'certFingerprint' in settings['idp'] and - len(settings['idp']['certFingerprint']) > 0) - if ((('wantAssertionsSigned' in security and security['wantAssertionsSigned']) or - ('wantMessagesSigned' in security and security['wantMessagesSigned'])) and - not(exists_X509 or exists_fingerprint)): - errors.append('idp_cert_or_fingerprint_not_found_and_required') - if ('nameIdEncrypted' in security and security['nameIdEncrypted']) and not exists_X509: - errors.append('idp_cert_not_found_and_required') - - if 'contactPerson' in settings: - types = settings['contactPerson'].keys() - valid_types = ['technical', 'support', 'administrative', 'billing', 'other'] - for t in types: - if t not in valid_types: - errors.append('contact_type_invalid') - break - - for t in settings['contactPerson']: - contact = settings['contactPerson'][t] - if (('givenName' not in contact or len(contact['givenName']) == 0) or - ('emailAddress' not in contact or len(contact['emailAddress']) == 0)): - errors.append('contact_not_enough_data') - break - - if 'organization' in settings: - for o in settings['organization']: - organization = settings['organization'][o] - if (('name' not in organization or len(organization['name']) == 0) or - ('displayname' not in organization or len(organization['displayname']) == 0) or - ('url' not in organization or len(organization['url']) == 0)): - errors.append('organization_not_enough_data') - break - - return errors -
-
[docs] def check_sp_certs(self): - """ - Checks if the x509 certs of the SP exists and are valid. - - :returns: If the x509 certs of the SP exists and are valid - :rtype: boolean - """ - key = self.get_sp_key() - cert = self.get_sp_cert() - return key is not None and cert is not None -
-
[docs] def get_sp_key(self): - """ - Returns the x509 private key of the SP. - - :returns: SP private key - :rtype: string - """ - key = None - key_file = self.__paths['cert'] + 'sp.key' - - if exists(key_file): - f = open(key_file, 'r') - key = f.read() - f.close() - - return key -
-
[docs] def get_sp_cert(self): - """ - Returns the x509 public cert of the SP. - - :returns: SP public cert - :rtype: string - """ - cert = None - cert_file = self.__paths['cert'] + 'sp.crt' - - if exists(cert_file): - f = open(cert_file, 'r') - cert = f.read() - f.close() - - return cert -
-
[docs] def get_idp_data(self): - """ - Gets the IdP data. - - :returns: IdP info - :rtype: dict - """ - return self.__idp -
-
[docs] def get_sp_data(self): - """ - Gets the SP data. - - :returns: SP info - :rtype: dict - """ - return self.__sp -
-
[docs] def get_security_data(self): - """ - Gets security data. - - :returns: Security info - :rtype: dict - """ - return self.__security -
-
[docs] def get_contacts(self): - """ - Gets contact data. - - :returns: Contacts info - :rtype: dict - """ - return self.__contacts -
-
[docs] def get_organization(self): - """ - Gets organization data. - - :returns: Organization info - :rtype: dict - """ - return self.__organization -
-
[docs] def get_sp_metadata(self): - """ - Gets the SP metadata. The XML representation. - - :returns: SP metadata (xml) - :rtype: string - """ - metadata = OneLogin_Saml2_Metadata.builder( - self.__sp, self.__security['authnRequestsSigned'], - self.__security['wantAssertionsSigned'], None, None, - self.get_contacts(), self.get_organization() - ) - cert = self.get_sp_cert() - if cert is not None: - metadata = OneLogin_Saml2_Metadata.add_x509_key_descriptors(metadata, cert) - - # Sign metadata - if 'signMetadata' in self.__security and self.__security['signMetadata'] is not False: - if self.__security['signMetadata'] is True: - key_file_name = 'sp.key' - cert_file_name = 'sp.crt' - else: - if ('keyFileName' not in self.__security['signMetadata'] or - 'certFileName' not in self.__security['signMetadata']): - raise OneLogin_Saml2_Error( - 'Invalid Setting: signMetadata value of the sp is not valid', - OneLogin_Saml2_Error.SETTINGS_INVALID_SYNTAX - ) - key_file_name = self.__security['signMetadata']['keyFileName'] - cert_file_name = self.__security['signMetadata']['certFileName'] - key_metadata_file = self.__paths['cert'] + key_file_name - cert_metadata_file = self.__paths['cert'] + cert_file_name - - if not exists(key_metadata_file): - raise OneLogin_Saml2_Error( - 'Private key file not found: %s', - OneLogin_Saml2_Error.PRIVATE_KEY_FILE_NOT_FOUND, - key_metadata_file - ) - - if not exists(cert_metadata_file): - raise OneLogin_Saml2_Error( - 'Public cert file not found: %s', - OneLogin_Saml2_Error.PUBLIC_CERT_FILE_NOT_FOUND, - cert_metadata_file - ) - - f = open(key_metadata_file, 'r') - key_metadata = f.read() - f.close() - f = open(cert_metadata_file, 'r') - cert_metadata = f.read() - f.close() - metadata = OneLogin_Saml2_Metadata.sign_metadata(metadata, key_metadata, cert_metadata) - - return metadata -
-
[docs] def validate_metadata(self, xml): - """ - Validates an XML SP Metadata. - - :param xml: Metadata's XML that will be validate - :type xml: string - - :returns: The list of found errors - :rtype: list - """ - - assert isinstance(xml, basestring) - - if len(xml) == 0: - raise Exception('Empty string supplied as input') - - errors = [] - res = OneLogin_Saml2_Utils.validate_xml(xml, 'saml-schema-metadata-2.0.xsd', self.__debug) - if not isinstance(res, Document): - errors.append(res) - else: - dom = res - element = dom.documentElement - if element.tagName != 'md:EntityDescriptor': - errors.append('noEntityDescriptor_xml') - else: - valid_until = cache_duration = expire_time = None - - if element.hasAttribute('validUntil'): - valid_until = OneLogin_Saml2_Utils.parse_SAML_to_time(element.getAttribute('validUntil')) - if element.hasAttribute('cacheDuration'): - cache_duration = element.getAttribute('cacheDuration') - - expire_time = OneLogin_Saml2_Utils.get_expire_time(cache_duration, valid_until) - if expire_time is not None and int(datetime.now().strftime('%s')) > int(expire_time): - errors.append('expired_xml') - - return errors -
-
[docs] def format_idp_cert(self): - """ - Formats the IdP cert. - """ - if self.__idp['x509cert'] is not None: - self.__idp['x509cert'] = OneLogin_Saml2_Utils.format_cert(self.__idp['x509cert']) -
-
[docs] def get_errors(self): - """ - Returns an array with the errors, the array is empty when the settings is ok. - - :returns: Errors - :rtype: list - """ - return self.__errors -
-
[docs] def set_strict(self, value): - """ - Activates or deactivates the strict mode. - - :param xml: Strict parameter - :type xml: boolean - """ - assert isinstance(value, bool) - - self.__strict = value -
-
[docs] def is_strict(self): - """ - Returns if the 'strict' mode is active. - - :returns: Strict parameter - :rtype: boolean - """ - return self.__strict -
-
[docs] def is_debug_active(self): - """ - Returns if the debug is active. - - :returns: Debug parameter - :rtype: boolean - """ - return self.__debug
-
- -
-
-
-
-
- - -
-
-
-
- - - - diff --git a/docs/saml2/_modules/saml2/utils.html b/docs/saml2/_modules/saml2/utils.html deleted file mode 100644 index 613d2a09..00000000 --- a/docs/saml2/_modules/saml2/utils.html +++ /dev/null @@ -1,805 +0,0 @@ - - - - - - - - - - saml2.utils — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -

Source code for saml2.utils

-# -*- coding: utf-8 -*-
-
-# Copyright (c) 2010-2018 OneLogin, Inc.
-# MIT License
-
-import base64
-from datetime import datetime
-import calendar
-from hashlib import sha1
-from isodate import parse_duration as duration_parser
-from lxml import etree
-from lxml.etree import ElementBase
-from os.path import basename, dirname, join
-import re
-from sys import stderr
-from tempfile import NamedTemporaryFile
-from textwrap import wrap
-from urllib import quote_plus
-from uuid import uuid4
-from xml.dom.minidom import Document, parseString, Element
-from xml.etree.ElementTree import tostring
-import zlib
-
-import dm.xmlsec.binding as xmlsec
-from dm.xmlsec.binding.tmpl import EncData, Signature
-from M2Crypto import X509
-
-from saml2.constants import OneLogin_Saml2_Constants
-from saml2.errors import OneLogin_Saml2_Error
-
-
-def _(msg):
-    # Fixme Add i18n support
-    return msg
-
-
-
[docs]class OneLogin_Saml2_Utils: - - @staticmethod -
[docs] def decode_base64_and_inflate(value): - """ base64 decodes and then inflates according to RFC1951 - :param value: a deflated and encoded string - :return: the string after decoding and inflating - """ - - return zlib.decompress(base64.b64decode(value), -15) -
- @staticmethod -
[docs] def deflate_and_base64_encode(value): - """ - Deflates and the base64 encodes a string - :param value: The string to deflate and encode - :return: The deflated and encoded string - """ - return base64.b64encode(zlib.compress(value)[2:-4]) -
- @staticmethod -
[docs] def validate_xml(xml, schema, debug=False): - """ - """ - assert (isinstance(xml, basestring) or isinstance(xml, Document)) - assert isinstance(schema, basestring) - - if isinstance(xml, Document): - xml = xml.toxml() - - # Switch to lxml for schema validation - try: - dom = etree.fromstring(xml) - except Exception: - return 'unloaded_xml' - - schema_file = join(dirname(__file__), 'schemas', schema) - f = open(schema_file, 'r') - schema_doc = etree.parse(f) - f.close() - xmlschema = etree.XMLSchema(schema_doc) - - if not xmlschema.validate(dom): - xml_errors = [xmlschema.error_log] - if debug: - stderr.write('Errors validating the metadata') - stderr.write(':\n\n') - for error in xml_errors: - stderr.write('%s\n' % error.message) - - return 'invalid_xml' - - return parseString(etree.tostring(dom)) -
- @staticmethod -
[docs] def format_cert(cert, heads=True): - """ - Returns a x509 cert (adding header & footer if required). - - :param cert: A x509 unformated cert - :type: string - - :param heads: True if we want to include head and footer - :type: boolean - - :returns: Formated cert - :rtype: string - """ - x509_cert = cert.replace('\x0D', '') - x509_cert = x509_cert.replace('\r', '') - x509_cert = x509_cert.replace('\n', '') - if len(x509_cert) > 0: - x509_cert = x509_cert.replace('-----BEGIN CERTIFICATE-----', '') - x509_cert = x509_cert.replace('-----END CERTIFICATE-----', '') - x509_cert = x509_cert.replace(' ', '') - - if heads: - x509_cert = '-----BEGIN CERTIFICATE-----\n' + '\n'.join(wrap(x509_cert, 64)) + '\n-----END CERTIFICATE-----\n' - - return x509_cert -
- @staticmethod -
[docs] def redirect(url, parameters={}, request_data={}): - """ - Executes a redirection to the provided url (or return the target url). - - :param url: The target url - :type: string - - :param parameters: Extra parameters to be passed as part of the url - :type: dict - - :param request_data: The request as a dict - :type: dict - - :returns: Url - :rtype: string - """ - assert isinstance(url, basestring) - assert isinstance(parameters, dict) - - if url.startswith('/'): - url = '%s%s' % (OneLogin_Saml2_Utils.get_self_url_host(request_data), url) - - # Verify that the URL is to a http or https site. - if re.search('^https?://', url) is None: - raise OneLogin_Saml2_Error( - 'Redirect to invalid URL: ' + url, - OneLogin_Saml2_Error.REDIRECT_INVALID_URL - ) - - # Add encoded parameters - if url.find('?') < 0: - param_prefix = '?' - else: - param_prefix = '&' - - for name, value in parameters.items(): - - if value is None: - param = urlencode(name) - elif isinstance(value, list): - param = '' - for val in value: - param += quote_plus(name) + '[]=' + quote_plus(val) + '&' - if len(param) > 0: - param = param[0:-1] - else: - param = quote_plus(name) + '=' + quote_plus(value) - - url += param_prefix + param - param_prefix = '&' - - return url -
- @staticmethod -
[docs] def get_self_url_host(request_data): - """ - Returns the protocol + the current host + the port (if different than - common ports). - - :param request_data: The request as a dict - :type: dict - - :return: Url - :rtype: string - """ - current_host = OneLogin_Saml2_Utils.get_self_host(request_data) - port = '' - if OneLogin_Saml2_Utils.is_https(request_data): - protocol = 'https' - else: - protocol = 'http' - - if 'server_port' in request_data: - port_number = request_data['server_port'] - port = ':' + port_number - - if protocol == 'http' and port_number == '80': - port = '' - elif protocol == 'https' and port_number == '443': - port = '' - - return '%s://%s%s' % (protocol, current_host, port) -
- @staticmethod -
[docs] def get_self_host(request_data): - """ - Returns the current host. - - :param request_data: The request as a dict - :type: dict - - :return: The current host - :rtype: string - """ - if 'http_host' in request_data: - current_host = request_data['http_host'] - elif 'server_name' in request_data: - current_host = request_data['server_name'] - else: - raise Exception('No hostname defined') - - if ':' in current_host: - current_host_data = current_host.split(':') - possible_port = current_host_data[-1] - try: - possible_port = float(possible_port) - current_host = current_host_data[0] - except ValueError: - current_host = ':'.join(current_host_data) - - return current_host -
- @staticmethod -
[docs] def is_https(request_data): - """ - Checks if https or http. - - :param request_data: The request as a dict - :type: dict - - :return: False if https is not active - :rtype: boolean - """ - is_https = 'https' in request_data and request_data['https'] != 'off' - is_https = is_https or ('server_port' in request_data and request_data['server_port'] == '443') - return is_https -
- @staticmethod -
[docs] def get_self_url_no_query(request_data): - """ - Returns the URL of the current host + current view. - - :param request_data: The request as a dict - :type: dict - - :return: The url of current host + current view - :rtype: string - """ - self_url_host = OneLogin_Saml2_Utils.get_self_url_host(request_data) - script_name = request_data['script_name'] - if script_name[0] != '/': - script_name = '/' + script_name - self_url_host += script_name - if 'path_info' in request_data: - self_url_host += request_data['path_info'] - - return self_url_host -
- @staticmethod -
[docs] def get_self_url(request_data): - """ - Returns the URL of the current host + current view + query. - - :param request_data: The request as a dict - :type: dict - - :return: The url of current host + current view + query - :rtype: string - """ - self_url_host = OneLogin_Saml2_Utils.get_self_url_host(request_data) - - request_uri = '' - if 'request_uri' in request_data: - request_uri = request_data['request_uri'] - if not request_uri.startswith('/'): - match = re.search('^https?://[^/]*(/.*)', request_uri) - if match is not None: - request_uri = match.groups()[0] - - return self_url_host + request_uri -
- @staticmethod -
[docs] def generate_unique_id(): - """ - Generates an unique string (used for example as ID for assertions). - - :return: A unique string - :rtype: string - """ - return 'ONELOGIN_%s' % sha1(uuid4().hex).hexdigest() -
- @staticmethod -
[docs] def parse_time_to_SAML(time): - """ - Converts a UNIX timestamp to SAML2 timestamp on the form - yyyy-mm-ddThh:mm:ss(\.s+)?Z. - - :param time: The time we should convert (DateTime). - :type: string - - :return: SAML2 timestamp. - :rtype: string - """ - data = datetime.utcfromtimestamp(float(time)) - return data.strftime('%Y-%m-%dT%H:%M:%SZ') -
- @staticmethod -
[docs] def parse_SAML_to_time(timestr): - """ - Converts a SAML2 timestamp on the form yyyy-mm-ddThh:mm:ss(\.s+)?Z - to a UNIX timestamp. The sub-second part is ignored. - - :param time: The time we should convert (SAML Timestamp). - :type: string - - :return: Converted to a unix timestamp. - :rtype: int - """ - try: - data = datetime.strptime(timestr, '%Y-%m-%dT%H:%M:%SZ') - except ValueError: - data = datetime.strptime(timestr, '%Y-%m-%dT%H:%M:%S.%fZ') - return calendar.timegm(data.utctimetuple()) -
- @staticmethod -
[docs] def parse_duration(duration, timestamp=None): - """ - Interprets a ISO8601 duration value relative to a given timestamp. - - :param duration: The duration, as a string. - :type: string - - :param timestamp: The unix timestamp we should apply the duration to. - Optional, default to the current time. - :type: string - - :return: The new timestamp, after the duration is applied. - :rtype: int - """ - assert isinstance(duration, basestring) - assert (timestamp is None or isinstance(timestamp, int)) - - timedelta = duration_parser(duration) - if timestamp is None: - data = datetime.utcnow() + timedelta - else: - data = datetime.utcfromtimestamp(timestamp) + timedelta - return calendar.timegm(data.utctimetuple()) -
- @staticmethod -
[docs] def get_expire_time(cache_duration=None, valid_until=None): - """ - Compares 2 dates and returns the earliest. - - :param cache_duration: The duration, as a string. - :type: string - - :param valid_until: The valid until date, as a string or as a timestamp - :type: string - - :return: The expiration time. - :rtype: int - """ - expire_time = None - - if cache_duration is not None: - expire_time = OneLogin_Saml2_Utils.parse_duration(cache_duration) - - if valid_until is not None: - if isinstance(valid_until, int): - valid_until_time = valid_until - else: - valid_until_time = OneLogin_Saml2_Utils.parse_SAML_to_time(valid_until) - if expire_time is None or expire_time > valid_until_time: - expire_time = valid_until_time - - if expire_time is not None: - return '%d' % expire_time - return None -
- @staticmethod -
[docs] def query(dom, query, context=None): - """ - Extracts nodes that match the query from the Element - - :param dom: The root of the lxml objet - :type: Element - - :param query: Xpath Expresion - :type: string - - :param context: Context Node - :type: DOMElement - - :returns: The queried nodes - :rtype: list - """ - if context is None: - return dom.xpath(query, namespaces=OneLogin_Saml2_Constants.NSMAP) - else: - return context.xpath(query, namespaces=OneLogin_Saml2_Constants.NSMAP) -
- @staticmethod -
[docs] def delete_local_session(callback=None): - """ - Deletes the local session. - """ - - if callback is not None: - callback() -
- @staticmethod -
[docs] def calculate_x509_fingerprint(x509_cert): - """ - Calculates the fingerprint of a x509cert. - - :param x509_cert: x509 cert - :type: string - - :returns: Formated fingerprint - :rtype: string - """ - assert isinstance(x509_cert, basestring) - - lines = x509_cert.split('\n') - data = '' - - for line in lines: - # Remove '\r' from end of line if present. - line = line.rstrip() - if line == '-----BEGIN CERTIFICATE-----': - # Delete junk from before the certificate. - data = '' - elif line == '-----END CERTIFICATE-----': - # Ignore data after the certificate. - break - elif line == '-----BEGIN PUBLIC KEY-----' or line == '-----BEGIN RSA PRIVATE KEY-----': - # This isn't an X509 certificate. - return None - else: - # Append the current line to the certificate data. - data += line - # "data" now contains the certificate as a base64-encoded string. The - # fingerprint of the certificate is the sha1-hash of the certificate. - return sha1(base64.b64decode(data)).hexdigest().lower() -
- @staticmethod -
[docs] def format_finger_print(fingerprint): - """ - Formates a fingerprint. - - :param fingerprint: fingerprint - :type: string - - :returns: Formated fingerprint - :rtype: string - """ - formated_fingerprint = fingerprint.replace(':', '') - return formated_fingerprint.lower() -
- @staticmethod -
[docs] def generate_name_id(value, sp_nq, sp_format, key=None): - """ - Generates a nameID. - - :param value: fingerprint - :type: string - - :param sp_nq: SP Name Qualifier - :type: string - - :param sp_format: SP Format - :type: string - - :param key: SP Key to encrypt the nameID - :type: string - - :returns: DOMElement | XMLSec nameID - :rtype: string - """ - doc = Document() - - name_id = doc.createElement('saml:NameID') - name_id.setAttribute('SPNameQualifier', sp_nq) - name_id.setAttribute('Format', sp_format) - name_id.appendChild(doc.createTextNode(value)) - - doc.appendChild(name_id) - - if key is not None: - xmlsec.initialize() - - # Load the private key - mngr = xmlsec.KeysMngr() - key = OneLogin_Saml2_Utils.format_cert(key, heads=False) - file_key = OneLogin_Saml2_Utils.write_temp_file(key) - key_data = xmlsec.Key.load(file_key.name, xmlsec.KeyDataFormatPem, None) - key_data.name = key_name = basename(file_key.name) - mngr.addKey(key_data) - file_key.close() - - # Prepare for encryption - enc_data = EncData(xmlsec.TransformAes128Cbc, type=xmlsec.TypeEncElement) - enc_data.ensureCipherValue() - key_info = enc_data.ensureKeyInfo() - enc_key = key_info.addEncryptedKey(xmlsec.TransformRsaPkcs1) - enc_key.ensureCipherValue() - enc_key_info = enc_key.ensureKeyInfo() - enc_key_info.addKeyName(key_name) - - # Encrypt! - enc_ctx = xmlsec.EncCtx(mngr) - enc_ctx.enc_key = xmlsec.Key.generate(xmlsec.KeyDataAes, 128, xmlsec.KeyDataTypeSession) - ed = enc_ctx.encryptXml(enc_data, doc.getroot()) - - # Build XML with encrypted data - newdoc = Document() - encrypted_id = newdoc.createElement('saml:EncryptedID') - newdoc.appendChild(encrypted_id) - encrypted_id.appendChild(encrypted_id.ownerDocument.importNode(ed, True)) - - return newdoc.saveXML(encrypted_id) - else: - return doc.saveXML(name_id) -
- @staticmethod -
[docs] def get_status(dom): - """ - Gets Status from a Response. - - :param dom: The Response as XML - :type: Document - - :returns: The Status, an array with the code and a message. - :rtype: dict - """ - status = {} - - status_entry = OneLogin_Saml2_Utils.query(dom, '/samlp:Response/samlp:Status') - if len(status_entry) == 0: - raise Exception('Missing Status on response') - - code_entry = OneLogin_Saml2_Utils.query(dom, '/samlp:Response/samlp:Status/samlp:StatusCode', status_entry[0]) - if len(code_entry) == 0: - raise Exception('Missing Status Code on response') - code = code_entry[0].values()[0] - status['code'] = code - - message_entry = OneLogin_Saml2_Utils.query(dom, '/samlp:Response/samlp:Status/samlp:StatusMessage', status_entry[0]) - if len(message_entry) == 0: - status['msg'] = '' - else: - status['msg'] = message_entry[0].text - - return status -
- @staticmethod -
[docs] def decrypt_element(encrypted_data, enc_ctx): - """ - Decrypts an encrypted element. - - :param encrypted_data: The encrypted data. - :type: DOMElement - - :param enc_ctx: The encryption context. - :type: Encryption Context - - :returns: The decrypted element. - :rtype: DOMElement - """ - if isinstance(encrypted_data, Element): - # Minidom element - encrypted_data = etree.fromstring(encrypted_data.toxml()) - - decrypted = enc_ctx.decrypt(encrypted_data) - if isinstance(decrypted, ElementBase): - # lxml element, decrypted xml data - return tostring(decrypted.getroottree()) - else: - # decrypted binary data - return decrypted -
- @staticmethod -
[docs] def write_temp_file(content): - """ - Writes some content into a temporary file and returns it. - - :param content: The file content - :type: string - - :returns: The temporary file - :rtype: file-like object - """ - f = NamedTemporaryFile(delete=True) - f.file.write(content) - f.file.flush() - return f -
- @staticmethod -
[docs] def add_sign(xml, key, cert): - """ - Adds signature key and senders certificate to an element (Message or - Assertion). - - :param xml: The element we should sign - :type: string | Document - - :param key: The private key - :type: string - - :param cert: The public - :type: string - """ - if isinstance(xml, Document): - dom = xml - else: - if xml == '': - raise Exception('Empty string supplied as input') - - try: - dom = parseString(xml) - except Exception: - raise Exception('Error parsing xml string') - - xmlsec.initialize() - - # TODO the key and cert could be file descriptors instead - # Load the private key. - file_key = OneLogin_Saml2_Utils.write_temp_file(key) - sign_key = xmlsec.Key.load(file_key.name, xmlsec.KeyDataFormatPem, None) - file_key.close() - # Add the certificate to the signature. - file_cert = OneLogin_Saml2_Utils.write_temp_file(cert) - sign_key.loadCert(file_cert.name, xmlsec.KeyDataFormatPem) - file_cert.close() - - # Get the EntityDescriptor node we should sign. - root_node = dom.firstChild - - # Sign the metadata with our private key. - signature = Signature(xmlsec.TransformExclC14N, xmlsec.TransformRsaSha1) - ref = signature.addReference(xmlsec.TransformSha1) - ref.addTransform(xmlsec.TransformEnveloped) - - key_info = signature.ensureKeyInfo() - key_info.addX509Data() - - dsig_ctx = xmlsec.DSigCtx() - dsig_ctx.signKey = sign_key - dsig_ctx.sign(signature) - - signature = tostring(signature).replace('ns0:', 'ds:').replace(':ns0', ':ds') - signature = parseString(signature).firstChild - - insert_before = root_node.getElementsByTagName('saml:Issuer') - if len(insert_before) > 0: - insert_before = insert_before[0].nextSibling - else: - insert_before = root_node.firstChild.nextSibling.nextSibling - root_node.insertBefore(signature, insert_before) - - return dom.toxml() -
- @staticmethod -
[docs] def validate_sign(xml, cert=None, fingerprint=None): - """ - Validates a signature (Message or Assertion). - - :param xml: The element we should validate - :type: string | Document - - :param cert: The pubic cert - :type: string - - :param fingerprint: The fingerprint of the public cert - :type: string - """ - if isinstance(xml, Document): - dom = etree.fromstring(xml.toxml()) - else: - if xml == '': - raise Exception('Empty string supplied as input') - - try: - dom = etree.fromstring(xml) - except Exception: - raise Exception('Error parsing xml string') - - xmlsec.initialize() - - # Find signature in the dom - signature_node = OneLogin_Saml2_Utils.query(dom, 'ds:Signature')[0] - - # Prepare context and load cert into it - dsig_ctx = xmlsec.DSigCtx() - sign_cert = X509.load_cert_string(str(cert), X509.FORMAT_PEM) - pub_key = sign_cert.get_pubkey().get_rsa() - sign_key = xmlsec.Key.loadMemory(pub_key.as_pem(cipher=None), - xmlsec.KeyDataFormatPem) - dsig_ctx.signKey = sign_key - - # Verify signature - dsig_ctx.verify(signature_node)
-
- -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/_sources/index.txt b/docs/saml2/_sources/index.txt deleted file mode 100644 index 43d48f47..00000000 --- a/docs/saml2/_sources/index.txt +++ /dev/null @@ -1,23 +0,0 @@ -.. saml2 documentation master file, created by - sphinx-quickstart on Thu Oct 23 03:29:00 2014. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to OneLogin SAML Python library documentation -===================================================== - -Contents: - -.. toctree:: - :maxdepth: 4 - - saml2 - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/docs/saml2/_sources/saml2.txt b/docs/saml2/_sources/saml2.txt deleted file mode 100644 index bf444d4d..00000000 --- a/docs/saml2/_sources/saml2.txt +++ /dev/null @@ -1,83 +0,0 @@ -OneLogin saml2 Module -====================== - -:mod:`auth` Class ------------------- - -.. automodule:: saml2.auth - :members: - :undoc-members: - :show-inheritance: - -:mod:`authn_request` Class ---------------------------- - -.. automodule:: saml2.authn_request - :members: - :undoc-members: - :show-inheritance: - -:mod:`constants` Class ------------------------ - -.. automodule:: saml2.constants - :members: - :undoc-members: - :show-inheritance: - -:mod:`errors` Class --------------------- - -.. automodule:: saml2.errors - :members: - :undoc-members: - :show-inheritance: - -:mod:`logout_request` Class ----------------------------- - -.. automodule:: saml2.logout_request - :members: - :undoc-members: - :show-inheritance: - -:mod:`logout_response` Class ------------------------------ - -.. automodule:: saml2.logout_response - :members: - :undoc-members: - :show-inheritance: - -:mod:`metadata` Class ----------------------- - -.. automodule:: saml2.metadata - :members: - :undoc-members: - :show-inheritance: - -:mod:`response` Class ----------------------- - -.. automodule:: saml2.response - :members: - :undoc-members: - :show-inheritance: - -:mod:`settings` Class ----------------------- - -.. automodule:: saml2.settings - :members: - :undoc-members: - :show-inheritance: - -:mod:`utils` Class -------------------- - -.. automodule:: saml2.utils - :members: - :undoc-members: - :show-inheritance: - diff --git a/docs/saml2/_static/ajax-loader.gif b/docs/saml2/_static/ajax-loader.gif deleted file mode 100644 index 61faf8cab23993bd3e1560bff0668bd628642330..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 673 zcmZ?wbhEHb6krfw_{6~Q|Nno%(3)e{?)x>&1u}A`t?OF7Z|1gRivOgXi&7IyQd1Pl zGfOfQ60;I3a`F>X^fL3(@);C=vM_KlFfb_o=k{|A33hf2a5d61U}gjg=>Rd%XaNQW zW@Cw{|b%Y*pl8F?4B9 zlo4Fz*0kZGJabY|>}Okf0}CCg{u4`zEPY^pV?j2@h+|igy0+Kz6p;@SpM4s6)XEMg z#3Y4GX>Hjlml5ftdH$4x0JGdn8~MX(U~_^d!Hi)=HU{V%g+mi8#UGbE-*ao8f#h+S z2a0-5+vc7MU$e-NhmBjLIC1v|)9+Im8x1yacJ7{^tLX(ZhYi^rpmXm0`@ku9b53aN zEXH@Y3JaztblgpxbJt{AtE1ad1Ca>{v$rwwvK(>{m~Gf_=-Ro7Fk{#;i~+{{>QtvI yb2P8Zac~?~=sRA>$6{!(^3;ZP0TPFR(G_-UDU(8Jl0?(IXu$~#4A!880|o%~Al1tN diff --git a/docs/saml2/_static/basic.css b/docs/saml2/_static/basic.css deleted file mode 100644 index 43e8bafa..00000000 --- a/docs/saml2/_static/basic.css +++ /dev/null @@ -1,540 +0,0 @@ -/* - * basic.css - * ~~~~~~~~~ - * - * Sphinx stylesheet -- basic theme. - * - * :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. - * :license: BSD, see LICENSE for details. - * - */ - -/* -- main layout ----------------------------------------------------------- */ - -div.clearer { - clear: both; -} - -/* -- relbar ---------------------------------------------------------------- */ - -div.related { - width: 100%; - font-size: 90%; -} - -div.related h3 { - display: none; -} - -div.related ul { - margin: 0; - padding: 0 0 0 10px; - list-style: none; -} - -div.related li { - display: inline; -} - -div.related li.right { - float: right; - margin-right: 5px; -} - -/* -- sidebar --------------------------------------------------------------- */ - -div.sphinxsidebarwrapper { - padding: 10px 5px 0 10px; -} - -div.sphinxsidebar { - float: left; - width: 230px; - margin-left: -100%; - font-size: 90%; -} - -div.sphinxsidebar ul { - list-style: none; -} - -div.sphinxsidebar ul ul, -div.sphinxsidebar ul.want-points { - margin-left: 20px; - list-style: square; -} - -div.sphinxsidebar ul ul { - margin-top: 0; - margin-bottom: 0; -} - -div.sphinxsidebar form { - margin-top: 10px; -} - -div.sphinxsidebar input { - border: 1px solid #98dbcc; - font-family: sans-serif; - font-size: 1em; -} - -div.sphinxsidebar #searchbox input[type="text"] { - width: 170px; -} - -div.sphinxsidebar #searchbox input[type="submit"] { - width: 30px; -} - -img { - border: 0; -} - -/* -- search page ----------------------------------------------------------- */ - -ul.search { - margin: 10px 0 0 20px; - padding: 0; -} - -ul.search li { - padding: 5px 0 5px 20px; - background-image: url(file.png); - background-repeat: no-repeat; - background-position: 0 7px; -} - -ul.search li a { - font-weight: bold; -} - -ul.search li div.context { - color: #888; - margin: 2px 0 0 30px; - text-align: left; -} - -ul.keywordmatches li.goodmatch a { - font-weight: bold; -} - -/* -- index page ------------------------------------------------------------ */ - -table.contentstable { - width: 90%; -} - -table.contentstable p.biglink { - line-height: 150%; -} - -a.biglink { - font-size: 1.3em; -} - -span.linkdescr { - font-style: italic; - padding-top: 5px; - font-size: 90%; -} - -/* -- general index --------------------------------------------------------- */ - -table.indextable { - width: 100%; -} - -table.indextable td { - text-align: left; - vertical-align: top; -} - -table.indextable dl, table.indextable dd { - margin-top: 0; - margin-bottom: 0; -} - -table.indextable tr.pcap { - height: 10px; -} - -table.indextable tr.cap { - margin-top: 10px; - background-color: #f2f2f2; -} - -img.toggler { - margin-right: 3px; - margin-top: 3px; - cursor: pointer; -} - -div.modindex-jumpbox { - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - margin: 1em 0 1em 0; - padding: 0.4em; -} - -div.genindex-jumpbox { - border-top: 1px solid #ddd; - border-bottom: 1px solid #ddd; - margin: 1em 0 1em 0; - padding: 0.4em; -} - -/* -- general body styles --------------------------------------------------- */ - -a.headerlink { - visibility: hidden; -} - -h1:hover > a.headerlink, -h2:hover > a.headerlink, -h3:hover > a.headerlink, -h4:hover > a.headerlink, -h5:hover > a.headerlink, -h6:hover > a.headerlink, -dt:hover > a.headerlink { - visibility: visible; -} - -div.body p.caption { - text-align: inherit; -} - -div.body td { - text-align: left; -} - -.field-list ul { - padding-left: 1em; -} - -.first { - margin-top: 0 !important; -} - -p.rubric { - margin-top: 30px; - font-weight: bold; -} - -img.align-left, .figure.align-left, object.align-left { - clear: left; - float: left; - margin-right: 1em; -} - -img.align-right, .figure.align-right, object.align-right { - clear: right; - float: right; - margin-left: 1em; -} - -img.align-center, .figure.align-center, object.align-center { - display: block; - margin-left: auto; - margin-right: auto; -} - -.align-left { - text-align: left; -} - -.align-center { - text-align: center; -} - -.align-right { - text-align: right; -} - -/* -- sidebars -------------------------------------------------------------- */ - -div.sidebar { - margin: 0 0 0.5em 1em; - border: 1px solid #ddb; - padding: 7px 7px 0 7px; - background-color: #ffe; - width: 40%; - float: right; -} - -p.sidebar-title { - font-weight: bold; -} - -/* -- topics ---------------------------------------------------------------- */ - -div.topic { - border: 1px solid #ccc; - padding: 7px 7px 0 7px; - margin: 10px 0 10px 0; -} - -p.topic-title { - font-size: 1.1em; - font-weight: bold; - margin-top: 10px; -} - -/* -- admonitions ----------------------------------------------------------- */ - -div.admonition { - margin-top: 10px; - margin-bottom: 10px; - padding: 7px; -} - -div.admonition dt { - font-weight: bold; -} - -div.admonition dl { - margin-bottom: 0; -} - -p.admonition-title { - margin: 0px 10px 5px 0px; - font-weight: bold; -} - -div.body p.centered { - text-align: center; - margin-top: 25px; -} - -/* -- tables ---------------------------------------------------------------- */ - -table.docutils { - border: 0; - border-collapse: collapse; -} - -table.docutils td, table.docutils th { - padding: 1px 8px 1px 5px; - border-top: 0; - border-left: 0; - border-right: 0; - border-bottom: 1px solid #aaa; -} - -table.field-list td, table.field-list th { - border: 0 !important; -} - -table.footnote td, table.footnote th { - border: 0 !important; -} - -th { - text-align: left; - padding-right: 5px; -} - -table.citation { - border-left: solid 1px gray; - margin-left: 1px; -} - -table.citation td { - border-bottom: none; -} - -/* -- other body styles ----------------------------------------------------- */ - -ol.arabic { - list-style: decimal; -} - -ol.loweralpha { - list-style: lower-alpha; -} - -ol.upperalpha { - list-style: upper-alpha; -} - -ol.lowerroman { - list-style: lower-roman; -} - -ol.upperroman { - list-style: upper-roman; -} - -dl { - margin-bottom: 15px; -} - -dd p { - margin-top: 0px; -} - -dd ul, dd table { - margin-bottom: 10px; -} - -dd { - margin-top: 3px; - margin-bottom: 10px; - margin-left: 30px; -} - -dt:target, .highlighted { - background-color: #fbe54e; -} - -dl.glossary dt { - font-weight: bold; - font-size: 1.1em; -} - -.field-list ul { - margin: 0; - padding-left: 1em; -} - -.field-list p { - margin: 0; -} - -.refcount { - color: #060; -} - -.optional { - font-size: 1.3em; -} - -.versionmodified { - font-style: italic; -} - -.system-message { - background-color: #fda; - padding: 5px; - border: 3px solid red; -} - -.footnote:target { - background-color: #ffa; -} - -.line-block { - display: block; - margin-top: 1em; - margin-bottom: 1em; -} - -.line-block .line-block { - margin-top: 0; - margin-bottom: 0; - margin-left: 1.5em; -} - -.guilabel, .menuselection { - font-family: sans-serif; -} - -.accelerator { - text-decoration: underline; -} - -.classifier { - font-style: oblique; -} - -abbr, acronym { - border-bottom: dotted 1px; - cursor: help; -} - -/* -- code displays --------------------------------------------------------- */ - -pre { - overflow: auto; - overflow-y: hidden; /* fixes display issues on Chrome browsers */ -} - -td.linenos pre { - padding: 5px 0px; - border: 0; - background-color: transparent; - color: #aaa; -} - -table.highlighttable { - margin-left: 0.5em; -} - -table.highlighttable td { - padding: 0 0.5em 0 0.5em; -} - -tt.descname { - background-color: transparent; - font-weight: bold; - font-size: 1.2em; -} - -tt.descclassname { - background-color: transparent; -} - -tt.xref, a tt { - background-color: transparent; - font-weight: bold; -} - -h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { - background-color: transparent; -} - -.viewcode-link { - float: right; -} - -.viewcode-back { - float: right; - font-family: sans-serif; -} - -div.viewcode-block:target { - margin: -1px -10px; - padding: 0 10px; -} - -/* -- math display ---------------------------------------------------------- */ - -img.math { - vertical-align: middle; -} - -div.body div.math p { - text-align: center; -} - -span.eqno { - float: right; -} - -/* -- printout stylesheet --------------------------------------------------- */ - -@media print { - div.document, - div.documentwrapper, - div.bodywrapper { - margin: 0 !important; - width: 100%; - } - - div.sphinxsidebar, - div.related, - div.footer, - #top-link { - display: none; - } -} \ No newline at end of file diff --git a/docs/saml2/_static/comment-bright.png b/docs/saml2/_static/comment-bright.png deleted file mode 100644 index 551517b8c83b76f734ff791f847829a760ad1903..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3500 zcmV;d4O8-oP)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RV2niQ93PPz|JOBU!-bqA3 zR5;6pl1pe^WfX zkSdl!omi0~*ntl;2q{jA^;J@WT8O!=A(Gck8fa>hn{#u{`Tyg)!KXI6l>4dj==iVKK6+%4zaRizy(5eryC3d2 z+5Y_D$4}k5v2=Siw{=O)SWY2HJwR3xX1*M*9G^XQ*TCNXF$Vj(kbMJXK0DaS_Sa^1 z?CEa!cFWDhcwxy%a?i@DN|G6-M#uuWU>lss@I>;$xmQ|`u3f;MQ|pYuHxxvMeq4TW;>|7Z2*AsqT=`-1O~nTm6O&pNEK?^cf9CX= zkq5|qAoE7un3V z^yy=@%6zqN^x`#qW+;e7j>th{6GV}sf*}g7{(R#T)yg-AZh0C&U;WA`AL$qz8()5^ zGFi2`g&L7!c?x+A2oOaG0c*Bg&YZt8cJ{jq_W{uTdA-<;`@iP$$=$H?gYIYc_q^*$ z#k(Key`d40R3?+GmgK8hHJcwiQ~r4By@w9*PuzR>x3#(F?YW_W5pPc(t(@-Y{psOt zz2!UE_5S)bLF)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RV2oe()A>y0J-2easEJ;K` zR5;6Jl3z%jbr{D#&+mQTbB>-f&3W<<%ayjKi&ZjBc2N<@)`~{dMXWB0(ajbV85_gJ zf(EU`iek}4Bt%55ix|sVMm1u8KvB#hnmU~_r<Ogd(A5vg_omvd-#L!=(BMVklxVqhdT zofSj`QA^|)G*lu58>#vhvA)%0Or&dIsb%b)st*LV8`ANnOipDbh%_*c7`d6# z21*z~Xd?ovgf>zq(o0?Et~9ti+pljZC~#_KvJhA>u91WRaq|uqBBKP6V0?p-NL59w zrK0w($_m#SDPQ!Z$nhd^JO|f+7k5xca94d2OLJ&sSxlB7F%NtrF@@O7WWlkHSDtor zzD?u;b&KN$*MnHx;JDy9P~G<{4}9__s&MATBV4R+MuA8TjlZ3ye&qZMCUe8ihBnHI zhMSu zSERHwrmBb$SWVr+)Yk2k^FgTMR6mP;@FY2{}BeV|SUo=mNk<-XSOHNErw>s{^rR-bu$@aN7= zj~-qXcS2!BA*(Q**BOOl{FggkyHdCJi_Fy>?_K+G+DYwIn8`29DYPg&s4$}7D`fv? zuyJ2sMfJX(I^yrf6u!(~9anf(AqAk&ke}uL0SIb-H!SaDQvd(}07*qoM6N<$g1Ha7 A2LJ#7 diff --git a/docs/saml2/_static/comment.png b/docs/saml2/_static/comment.png deleted file mode 100644 index 92feb52b8824c6b0f59b658b1196c61de9162a95..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3445 zcmV-*4T|!KP)Oz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$}* z))J2sFA#f(L&P^E5{W}HC%KRUNwK6<(h|}}(r!{C=`5+6G)NjFlgZj-YqAG9lq?`C z$c5yc>d>VnA`E_*3F2Qp##d8RZb=H01_mm@+|Cqnc9PsG(F5HIG_C zt)aG3uTh7n6Et<2In9F>NlT@zqLtGcXcuVrX|L#Xx)I%#9!{6gSJKPrN9dR61N3(c z4Tcqi$B1Vr8Jidf7-t!G7_XR2rWwr)$3XQ?}=hpK0&Z&W{| zep&sA23f;Q!%st`QJ}G3cbou<7-yIK2z4nfCCCtN2-XOGSWo##{8Q{ATurxr~;I`ytDs%xbip}RzP zziy}Qn4Z2~fSycmr`~zJ=lUFdFa1>gZThG6M+{g7vkW8#+YHVaJjFF}Z#*3@$J_By zLtVo_L#1JrVVB{Ak-5=4qt!-@Mh}c>#$4kh<88)m#-k<%CLtzEP3leVno>={htGUuD;o7bD)w_sX$S}eAxwzy?UvgBH(S?;#HZiQMoS*2K2 zT3xe7t(~nU*1N5{rxB;QPLocnp4Ml>u<^FZwyC!nu;thW+pe~4wtZn|Vi#w(#jeBd zlf9FDx_yoPJqHbk*$%56S{;6Kv~mM9!g3B(KJ}#RZ#@)!hR|78Dq|Iq-afF%KE1Brn_fm;Im z_u$xr8UFki1L{Ox>G0o)(&RAZ;=|I=wN2l97;cLaHH6leTB-XXa*h%dBOEvi`+x zi?=Txl?TadvyiL>SuF~-LZ;|cS}4~l2eM~nS7yJ>iOM;atDY;(?aZ^v+mJV$@1Ote z62cPUlD4IWOIIx&SmwQ~YB{nzae3Pc;}r!fhE@iwJh+OsDs9zItL;~pu715HdQEGA zUct(O!LkCy1<%NCg+}G`0PgpNm-?d@-hMgNe6^V+j6x$b<6@S<$+<4_1hi}Ti zncS4LsjI}fWY1>OX6feMEuLErma3QLmkw?X+1j)X-&VBk_4Y;EFPF_I+q;9dL%E~B zJh;4Nr^(LEJ3myURP{Rblsw%57T)g973R8o)DE9*xN#~;4_o$q%o z4K@u`jhx2fBXC4{U8Qn{*%*B$Ge=nny$HAYq{=vy|sI0 z_vss+H_qMky?OB#|JK!>IX&II^LlUh#rO5!7TtbwC;iULyV-Xq?ybB}ykGP{?LpZ? z-G|jbTmIbG@7#ZCz;~eY(cDM(28Dyq{*m>M4?_iynUBkc4TkHUI6gT!;y-fz>HMcd z&t%Ugo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P` z?ZJ24cOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy000JJOGiWi{{a60 z|De66lK=n!32;bRa{vGf6951U69E94oEQKA00(qQO+^RV2nzr)JMUJvzW@LNr%6OX zR5;6Zk;`k`RTRfR-*ac2G}PGmXsUu>6ce?Lsn$m^3Q`48f|TwQ+_-Qh=t8Ra7nE)y zf@08(pjZ@22^EVjG*%30TJRMkBUC$WqZ73uoiv&J=APqX;!v%AH}`Vx`999MVjXwy z{f1-vh8P<=plv&cZ>p5jjX~Vt&W0e)wpw1RFRuRdDkwlKb01tp5 zP=trFN0gH^|L4jJkB{6sCV;Q!ewpg-D&4cza%GQ*b>R*=34#dW;ek`FEiB(vnw+U# zpOX5UMJBhIN&;D1!yQoIAySC!9zqJmmfoJqmQp}p&h*HTfMh~u9rKic2oz3sNM^#F zBIq*MRLbsMt%y{EHj8}LeqUUvoxf0=kqji62>ne+U`d#%J)abyK&Y`=eD%oA!36<)baZyK zXJh5im6umkS|_CSGXips$nI)oBHXojzBzyY_M5K*uvb0_9viuBVyV%5VtJ*Am1ag# zczbv4B?u8j68iOz<+)nDu^oWnL+$_G{PZOCcOGQ?!1VCefves~rfpaEZs-PdVYMiV z98ElaJ2}7f;htSXFY#Zv?__sQeckE^HV{ItO=)2hMQs=(_ Xn!ZpXD%P(H00000NkvXXu0mjf= 0 && !jQuery(node.parentNode).hasMethod(className)) { - var span = document.createElement("span"); - span.className = className; - span.appendChild(document.createTextNode(val.substr(pos, text.length))); - node.parentNode.insertBefore(span, node.parentNode.insertBefore( - document.createTextNode(val.substr(pos + text.length)), - node.nextSibling)); - node.nodeValue = val.substr(0, pos); - } - } - else if (!jQuery(node).is("button, select, textarea")) { - jQuery.each(node.childNodes, function() { - highlight(this); - }); - } - } - return this.each(function() { - highlight(this); - }); -}; - -/** - * Small JavaScript module for the documentation. - */ -var Documentation = { - - init : function() { - this.fixFirefoxAnchorBug(); - this.highlightSearchWords(); - this.initIndexTable(); - }, - - /** - * i18n support - */ - TRANSLATIONS : {}, - PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, - LOCALE : 'unknown', - - // gettext and ngettext don't access this so that the functions - // can safely bound to a different name (_ = Documentation.gettext) - gettext : function(string) { - var translated = Documentation.TRANSLATIONS[string]; - if (typeof translated == 'undefined') - return string; - return (typeof translated == 'string') ? translated : translated[0]; - }, - - ngettext : function(singular, plural, n) { - var translated = Documentation.TRANSLATIONS[singular]; - if (typeof translated == 'undefined') - return (n == 1) ? singular : plural; - return translated[Documentation.PLURALEXPR(n)]; - }, - - addTranslations : function(catalog) { - for (var key in catalog.messages) - this.TRANSLATIONS[key] = catalog.messages[key]; - this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); - this.LOCALE = catalog.locale; - }, - - /** - * add context elements like header anchor links - */ - addContextElements : function() { - $('div[id] > :header:first').each(function() { - $('\u00B6'). - attr('href', '#' + this.id). - attr('title', _('Permalink to this headline')). - appendTo(this); - }); - $('dt[id]').each(function() { - $('\u00B6'). - attr('href', '#' + this.id). - attr('title', _('Permalink to this definition')). - appendTo(this); - }); - }, - - /** - * workaround a firefox stupidity - */ - fixFirefoxAnchorBug : function() { - if (document.location.hash && $.browser.mozilla) - window.setTimeout(function() { - document.location.href += ''; - }, 10); - }, - - /** - * highlight the search words provided in the url in the text - */ - highlightSearchWords : function() { - var params = $.getQueryParameters(); - var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; - if (terms.length) { - var body = $('div.body'); - window.setTimeout(function() { - $.each(terms, function() { - body.highlightText(this.toLowerCase(), 'highlighted'); - }); - }, 10); - $('') - .appendTo($('#searchbox')); - } - }, - - /** - * init the domain index toggle buttons - */ - initIndexTable : function() { - var togglers = $('img.toggler').click(function() { - var src = $(this).attr('src'); - var idnum = $(this).attr('id').substr(7); - $('tr.cg-' + idnum).toggle(); - if (src.substr(-9) == 'minus.png') - $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); - else - $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); - }).css('display', ''); - if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { - togglers.click(); - } - }, - - /** - * helper function to hide the search marks again - */ - hideSearchWords : function() { - $('#searchbox .highlight-link').fadeOut(300); - $('span.highlighted').removeMethod('highlighted'); - }, - - /** - * make the url absolute - */ - makeURL : function(relativeURL) { - return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; - }, - - /** - * get the current relative url - */ - getCurrentURL : function() { - var path = document.location.pathname; - var parts = path.split(/\//); - $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { - if (this == '..') - parts.pop(); - }); - var url = parts.join('/'); - return path.substring(url.lastIndexOf('/') + 1, path.length - 1); - } -}; - -// quick alias for translations -_ = Documentation.gettext; - -$(document).ready(function() { - Documentation.init(); -}); diff --git a/docs/saml2/_static/down-pressed.png b/docs/saml2/_static/down-pressed.png deleted file mode 100644 index 6f7ad782782e4f8e39b0c6e15c7344700cdd2527..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 368 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*yM+OLB!qm#z$3ZNi+iKnkC`z>}Z23@f-Ava~9&<9T!#}JFtXD=!G zGdl{fK6ro2OGiOl+hKvH6i=D3%%Y^j`yIkRn!8O>@bG)IQR0{Kf+mxNd=_WScA8u_ z3;8(7x2){m9`nt+U(Nab&1G)!{`SPVpDX$w8McLTzAJ39wprG3p4XLq$06M`%}2Yk zRPPsbES*dnYm1wkGL;iioAUB*Or2kz6(-M_r_#Me-`{mj$Z%( diff --git a/docs/saml2/_static/down.png b/docs/saml2/_static/down.png deleted file mode 100644 index 3003a88770de3977d47a2ba69893436a2860f9e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 363 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6U4S$Y z{B+)352QE?JR*yM+OLB!qm#z$3ZNi+iKnkC`z>}xaV3tUZ$qnrLa#kt978NlpS`ru z&)HFc^}^>{UOEce+71h5nn>6&w6A!ieNbu1wh)UGh{8~et^#oZ1# z>T7oM=FZ~xXWnTo{qnXm$ZLOlqGswI_m2{XwVK)IJmBjW{J3-B3x@C=M{ShWt#fYS9M?R;8K$~YwlIqwf>VA7q=YKcwf2DS4Zj5inDKXXB1zl=(YO3ST6~rDq)&z z*o>z)=hxrfG-cDBW0G$!?6{M<$@{_4{m1o%Ub!naEtn|@^frU1tDnm{r-UW|!^@B8 diff --git a/docs/saml2/_static/file.png b/docs/saml2/_static/file.png deleted file mode 100644 index d18082e397e7e54f20721af768c4c2983258f1b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 392 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmP$HyOL$D9)yc9|lc|nKf<9@eUiWd>3GuTC!a5vdfWYEazjncPj5ZQX%+1 zt8B*4=d)!cdDz4wr^#OMYfqGz$1LDFF>|#>*O?AGil(WEs?wLLy{Gj2J_@opDm%`dlax3yA*@*N$G&*ukFv>P8+2CBWO(qz zD0k1@kN>hhb1_6`&wrCswzINE(evt-5C1B^STi2@PmdKI;Vst0PQB6!2kdN diff --git a/docs/saml2/_static/jquery.js b/docs/saml2/_static/jquery.js deleted file mode 100644 index dc2f3dac..00000000 --- a/docs/saml2/_static/jquery.js +++ /dev/null @@ -1,9404 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.2 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Fri Jul 5 14:07:58 UTC 2013 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Method]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.2", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, pass ) { - var exec, - bulk = key == null, - i = 0, - length = elems.length; - - // Sets many values - if ( key && typeof key === "object" ) { - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); - } - chainable = 1; - - // Sets one value - } else if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = pass === undefined && jQuery.isFunction( value ); - - if ( bulk ) { - // Bulk operations only iterate when executing function values - if ( exec ) { - exec = fn; - fn = function( elem, key, value ) { - return exec.call( jQuery( elem ), value ); - }; - - // Otherwise they run against the entire set - } else { - fn.call( elems, value ); - fn = null; - } - } - - if ( fn ) { - for (; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - } - - chainable = 1; - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - fired = true; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - pixelMargin: true - }; - - // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead - jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat"); - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for ( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight, - paddingMarginBorderVisibility, paddingMarginBorder, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - paddingMarginBorder = "padding:0;margin:0;border:"; - positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;"; - paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;"; - style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;"; - html = "
" + - "" + - "
"; - - container = document.createElement("div"); - container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
t
"; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - div.innerHTML = ""; - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.innerHTML = ""; - div.style.width = div.style.padding = "1px"; - div.style.border = 0; - div.style.overflow = "hidden"; - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = "block"; - div.style.overflow = "visible"; - div.innerHTML = "
"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - } - - div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - if ( window.getComputedStyle ) { - div.style.marginTop = "1%"; - support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%"; - } - - if ( typeof container.style.zoom !== "undefined" ) { - container.style.zoom = 1; - } - - body.removeChild( container ); - marginDiv = div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, part, attr, name, l, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attr = elem.attributes; - for ( l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split( ".", 2 ); - parts[1] = parts[1] ? "." + parts[1] : ""; - part = parts[1] + "!"; - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - data = this.triggerHandler( "getData" + part, [ parts[0] ] ); - - // Try to fetch any internally stored data first - if ( data === undefined && elem ) { - data = jQuery.data( elem, key ); - data = dataAttr( elem, key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - } - - parts[1] = value; - this.each(function() { - var self = jQuery( this ); - - self.triggerHandler( "setData" + part, parts ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + part, parts ); - }); - }, null, value, arguments.length > 1, null, false ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise( object ); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addMethod: function( value ) { - var classNames, i, l, elem, - setMethod, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addMethod( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setMethod = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setMethod.indexOf( " " + classNames[ c ] + " " ) ) { - setMethod += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setMethod ); - } - } - } - } - - return this; - }, - - removeMethod: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeMethod( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleMethod: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleMethod( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasMethod( className ); - self[ state ? "addMethod" : "removeMethod" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasMethod: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, isBool, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - isBool = rboolean.test( name ); - - // See #9699 for explanation of this approach (setting first, then removal) - // Do not do this for boolean attributes (see #10870) - if ( !isBool ) { - jQuery.attr( elem, name, "" ); - } - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( isBool && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true, - coords: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /(?:^|\s)hover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: selector && quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - special = jQuery.event.special[ event.type ] || {}, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers that should run if there are delegated events - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - - // Don't process events on disabled elements (#6911, #8165) - if ( cur.disabled !== true ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { // && selector != null - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - /* falls through */ - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} -// Expose origPOS -// "global" as in regardless of relation to brackets/parens -Expr.match.globalPOS = origPOS; - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

"; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByMethodName ) { - return makeArray( context.getElementsByMethodName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
"; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByMethodName actually exists - if ( !div.getElementsByMethodName || div.getElementsByMethodName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByMethodName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByMethodName !== "undefined" && !isXML ) { - return context.getElementsByMethodName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.globalPOS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /]", "i"), - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /\/(java|ecma)script/i, - rcleanScript = /^\s*", "" ], - legend: [ 1, "
", "
" ], - thead: [ 1, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - col: [ 2, "", "
" ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - - - - - - - - -
-
-
-
- - -

Index

- -
- A - | B - | C - | D - | F - | G - | I - | L - | M - | N - | O - | P - | Q - | R - | S - | T - | V - | W - -
-

A

- - - -
- -
AC_KERBEROS (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
AC_PASSWORD (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
AC_SMARTCARD (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
AC_UNSPECIFIED (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
AC_X509 (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
add_sign() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- -
add_x509_key_descriptors() (saml2.metadata.OneLogin_Saml2_Metadata static method) -
- - -
ALOWED_CLOCK_DRIFT (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
ATTRNAME_FORMAT_BASIC (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
ATTRNAME_FORMAT_UNSPECIFIED (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
ATTRNAME_FORMAT_URI (saml2.constants.OneLogin_Saml2_Constants attribute) -
- -
- -

B

- - - -
- -
BINDING_DEFLATE (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
BINDING_HTTP_ARTIFACT (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
BINDING_HTTP_POST (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
BINDING_HTTP_REDIRECT (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
BINDING_SOAP (saml2.constants.OneLogin_Saml2_Constants attribute) -
- -
- -
build() (saml2.logout_response.OneLogin_Saml2_Logout_Response method) -
- - -
build_request_signature() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
build_response_signature() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
builder() (saml2.metadata.OneLogin_Saml2_Metadata static method) -
- -
- -

C

- - - -
- -
calculate_x509_fingerprint() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
check_settings() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
check_sp_certs() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
check_status() (saml2.response.OneLogin_Saml2_Response method) -
- -
- -
CM_BEARER (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
CM_HOLDER_KEY (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
CM_SENDER_VOUCHES (saml2.constants.OneLogin_Saml2_Constants attribute) -
- -
- -

D

- - - -
- -
decode_base64_and_inflate() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
decrypt_element() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- -
deflate_and_base64_encode() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
delete_local_session() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- -

F

- - - -
- -
format_cert() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
format_finger_print() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- -
format_idp_cert() (saml2.settings.OneLogin_Saml2_Settings method) -
- -
- -

G

- - - -
- -
generate_name_id() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
generate_unique_id() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
get_attribute() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
get_attributes() (saml2.auth.OneLogin_Saml2_Auth method) -
- -
- -
(saml2.response.OneLogin_Saml2_Response method) -
- -
- -
get_audiences() (saml2.response.OneLogin_Saml2_Response method) -
- - -
get_base_path() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_cert_path() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_contacts() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_errors() (saml2.auth.OneLogin_Saml2_Auth method) -
- -
- -
(saml2.settings.OneLogin_Saml2_Settings method) -
- -
- -
get_expire_time() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
get_ext_lib_path() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_id() (saml2.logout_request.OneLogin_Saml2_Logout_Request static method) -
- - -
get_idp_data() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_issuer() (saml2.logout_request.OneLogin_Saml2_Logout_Request static method) -
- -
- -
(saml2.logout_response.OneLogin_Saml2_Logout_Response method) -
- -
- -
get_issuers() (saml2.response.OneLogin_Saml2_Response method) -
- - -
get_lib_path() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_name_id() (saml2.logout_request.OneLogin_Saml2_Logout_Request static method) -
- - -
get_name_id_data() (saml2.logout_request.OneLogin_Saml2_Logout_Request static method) -
- - -
get_nameid() (saml2.auth.OneLogin_Saml2_Auth method) -
- -
- -
(saml2.response.OneLogin_Saml2_Response method) -
- -
- -
get_nameid_data() (saml2.response.OneLogin_Saml2_Response method) -
- -
- -
get_organization() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_request() (saml2.authn_request.OneLogin_Saml2_Authn_Request method) -
- -
- -
(saml2.logout_request.OneLogin_Saml2_Logout_Request method) -
- -
- -
get_response() (saml2.logout_response.OneLogin_Saml2_Logout_Response method) -
- - -
get_schemas_path() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_security_data() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_self_host() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
get_self_url() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
get_self_url_host() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
get_self_url_no_query() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
get_session_index() (saml2.response.OneLogin_Saml2_Response method) -
- - -
get_session_indexes() (saml2.logout_request.OneLogin_Saml2_Logout_Request static method) -
- - -
get_session_not_on_or_after() (saml2.response.OneLogin_Saml2_Response method) -
- - -
get_settings() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
get_slo_url() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
get_sp_cert() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_sp_data() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_sp_key() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_sp_metadata() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
get_sso_url() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
get_status() (saml2.logout_response.OneLogin_Saml2_Logout_Response method) -
- -
- -
(saml2.utils.OneLogin_Saml2_Utils static method) -
- -
-
- -

I

- - - -
- -
is_authenticated() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
is_debug_active() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
is_https() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- -
is_strict() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
is_valid() (saml2.logout_request.OneLogin_Saml2_Logout_Request static method) -
- -
- -
(saml2.logout_response.OneLogin_Saml2_Logout_Response method) -
- - -
(saml2.response.OneLogin_Saml2_Response method) -
- -
-
- -

L

- - - -
- -
login() (saml2.auth.OneLogin_Saml2_Auth method) -
- -
- -
logout() (saml2.auth.OneLogin_Saml2_Auth method) -
- -
- -

M

- - -
- -
METADATA_SP_INVALID (saml2.errors.OneLogin_Saml2_Error attribute) -
- -
- -

N

- - - -
- -
NAMEID_EMAIL_ADDRESS (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NAMEID_ENCRYPTED (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NAMEID_ENTITY (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NAMEID_KERBEROS (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NAMEID_PERSISTENT (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NAMEID_TRANSIENT (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NAMEID_WINDOWS_DOMAIN_QUALIFIED_NAME (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NAMEID_X509_SUBJECT_NAME (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NS_DS (saml2.constants.OneLogin_Saml2_Constants attribute) -
- -
- -
NS_MD (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NS_SAML (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NS_SAMLP (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NS_SOAP (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NS_XENC (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NS_XS (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NS_XSI (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
NSMAP (saml2.constants.OneLogin_Saml2_Constants attribute) -
- -
- -

O

- - - -
- -
OneLogin_Saml2_Auth (class in saml2.auth) -
- - -
OneLogin_Saml2_Authn_Request (class in saml2.authn_request) -
- - -
OneLogin_Saml2_Constants (class in saml2.constants) -
- - -
OneLogin_Saml2_Error -
- - -
OneLogin_Saml2_Logout_Request (class in saml2.logout_request) -
- -
- -
OneLogin_Saml2_Logout_Response (class in saml2.logout_response) -
- - -
OneLogin_Saml2_Metadata (class in saml2.metadata) -
- - -
OneLogin_Saml2_Response (class in saml2.response) -
- - -
OneLogin_Saml2_Settings (class in saml2.settings) -
- - -
OneLogin_Saml2_Utils (class in saml2.utils) -
- -
- -

P

- - - -
- -
parse_duration() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
parse_SAML_to_time() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
parse_time_to_SAML() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
PRIVATE_KEY_FILE_NOT_FOUND (saml2.errors.OneLogin_Saml2_Error attribute) -
- -
- -
process_response() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
process_slo() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
PUBLIC_CERT_FILE_NOT_FOUND (saml2.errors.OneLogin_Saml2_Error attribute) -
- -
- -

Q

- - -
- -
query() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- -

R

- - - -
- -
redirect() (saml2.utils.OneLogin_Saml2_Utils static method) -
- - -
REDIRECT_INVALID_URL (saml2.errors.OneLogin_Saml2_Error attribute) -
- -
- -
redirect_to() (saml2.auth.OneLogin_Saml2_Auth method) -
- - -
RSA_SHA1 (saml2.constants.OneLogin_Saml2_Constants attribute) -
- -
- -

S

- - - -
- -
saml2.auth (module) -
- - -
saml2.authn_request (module) -
- - -
saml2.constants (module) -
- - -
saml2.errors (module) -
- - -
saml2.logout_request (module) -
- - -
saml2.logout_response (module) -
- - -
saml2.metadata (module) -
- - -
saml2.response (module) -
- - -
saml2.settings (module) -
- - -
saml2.utils (module) -
- - -
SAML_LOGOUTMESSAGE_NOT_FOUND (saml2.errors.OneLogin_Saml2_Error attribute) -
- - -
SAML_LOGOUTREQUEST_INVALID (saml2.errors.OneLogin_Saml2_Error attribute) -
- - -
SAML_LOGOUTRESPONSE_INVALID (saml2.errors.OneLogin_Saml2_Error attribute) -
- - -
SAML_RESPONSE_NOT_FOUND (saml2.errors.OneLogin_Saml2_Error attribute) -
- -
- -
SAML_SINGLE_LOGOUT_NOT_SUPPORTED (saml2.errors.OneLogin_Saml2_Error attribute) -
- - -
set_strict() (saml2.auth.OneLogin_Saml2_Auth method) -
- -
- -
(saml2.settings.OneLogin_Saml2_Settings method) -
- -
- -
SETTINGS_FILE_NOT_FOUND (saml2.errors.OneLogin_Saml2_Error attribute) -
- - -
SETTINGS_INVALID (saml2.errors.OneLogin_Saml2_Error attribute) -
- - -
SETTINGS_INVALID_SYNTAX (saml2.errors.OneLogin_Saml2_Error attribute) -
- - -
sign_metadata() (saml2.metadata.OneLogin_Saml2_Metadata static method) -
- - -
SP_CERTS_NOT_FOUND (saml2.errors.OneLogin_Saml2_Error attribute) -
- - -
STATUS_NO_PASSIVE (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
STATUS_PARTIAL_LOGOUT (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
STATUS_PROXY_COUNT_EXCEEDED (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
STATUS_REQUESTER (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
STATUS_RESPONDER (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
STATUS_SUCCESS (saml2.constants.OneLogin_Saml2_Constants attribute) -
- - -
STATUS_VERSION_MISMATCH (saml2.constants.OneLogin_Saml2_Constants attribute) -
- -
- -

T

- - - -
- -
TIME_CACHED (saml2.metadata.OneLogin_Saml2_Metadata attribute) -
- -
- -
TIME_VALID (saml2.metadata.OneLogin_Saml2_Metadata attribute) -
- -
- -

V

- - - -
- -
validate_metadata() (saml2.settings.OneLogin_Saml2_Settings method) -
- - -
validate_num_assertions() (saml2.response.OneLogin_Saml2_Response method) -
- - -
validate_sign() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- -
validate_timestamps() (saml2.response.OneLogin_Saml2_Response method) -
- - -
validate_url() (in module saml2.settings) -
- - -
validate_xml() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- -

W

- - -
- -
write_temp_file() (saml2.utils.OneLogin_Saml2_Utils static method) -
- -
- - - -
-
-
-
-
- - - - - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/index.html b/docs/saml2/index.html deleted file mode 100644 index d17bd654..00000000 --- a/docs/saml2/index.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - Welcome to OneLogin SAML Python library documentation - - - - - - - - - - - - - - -
-
-
-
- - -
-

Indices and tables

- -
- - -
-
-
-
-
-

Table Of Contents

- - -

Next topic

-

onelogin.saml2 Module

-

This Page

- - - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/objects.inv b/docs/saml2/objects.inv deleted file mode 100644 index f4df5df0cf8a1203e12c4a54b64e6f611ff0f28d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1959 zcmV;Y2Uz$cAX9K?X>NERX>N99Zgg*Qc_4OWa&u{KZXhxWBOp+6Z)#;@bUGkUZe>hw zXK8LAQ$bBkAW(U9Xm4&HY-wV0VRCsOV{Bn_b7gZNVQyp~ZDn+5Z)9@{BOq2~a&u{K zZaN?eBOp|0Wgv28ZDDC{WMy(7Z)PBLXlZjGW@&6?AZc?TV{dJ6a%FRKWn>_Ab7^j8 zAbM?s|2V9Tf1|@6!eqtX@uVz%yH4whi=+}}pI!S5+dIDwDmJfIc?DEG0DJqur|?K!B{31A&7V8LW*>Hi?r-`~ zkfqjEOaSLKbZyaZjfr)g9g~9G6Y*`-rh2^}idyuG8Cw>KV31T9JSUv}@jI|8t+QT# z@>3#DPj7WFfkWX$tzL(bdvC=AzLF=nb>{^9Acosu;X9~pZ_M~mINhu(ofi2sG|A{w zla*?D#C3r9u^T_3_PFn%hmz;R(`bCE_M2x|&7zLa(={s-j#R-3Lr}ulOOv+@L|&q= z|ERq`cX^R*^a4CzRf*_YHffJ7%jEu2f!!S9#%&L7h!v3tb=wGmG`8Xe1-h_pLg`fZ zT-I%w2uN9rKD4$)R!PY;%<_1wm;`1tutIaFz?-ekF1EIeDIDCOq5{ag>cJALsgtq` zCQ-Mj)1&~-IM3?}D|Vy#L&?$3jig1w`GgC(aec@2zkow-=MupUJ4ZzRS`Zo|o$geG zp_Vs?dGIAz#GZ6F>x*uTIT^2iylo=5SaBSw03&x7c~%SypN7PCZ(ZV;((mTlj5*U; zTS9r`4o#dAo;WL(ia$YBgM_d4)qo>@Pl`NK1n8wKOi&(5;#l4Qy@c=RI1mj3-$6PM zR;}xrn+&c0v-ilI?C&0lEys#2pdq;ay)}0o4VmX-)md}SIdJ){bXsU>l9mrV3q%bH z#3u8tO(Y)z`Dr1Wr1emcw^@%}d2P03-C;$o}bb#r+D)5=uc|SWH6?Y51(}1Y2+YB~uA{o6-*DU=8N>qo~-l_YK zh~q}Y-rl+-l=JE3&$NAQWQJ0(QhI?YIG>(2jcP;RD+-2HNd#FbM0v|txRCjn0Qpn5 zkSv8EytF;I3+6J#QPtz0Q;OYezi%B49&g0tdm!nuoK-0XM^N&HNTd_x&;{vjjGIh@ z6+jQEDK%c}A1k4GhOO*rFhV3P(NV35BAg8Ip+)IK5aD$AMlaGF6~ZDo;#?7x`TL#q z!DR8m0AE^c2R(#Qel@CHGqk(QpHrTd|6@ijH?xF14u9OgPGF zHmx3+y_gDqbtPmT&5d4$XSs8*94Er|dhn@D)s-OeLt>qbQQRam53MM6tqqs{Ik9y& ze>AjhKj`7my(be*-vl;~1`tP+p7qA*wnZw!J#+Tkcw!%r!>q3supM z#@K*%3`xwijn(9Z!PzdlZM5O(4hr1Pp7to<@;bx{Zr_x#GWaNK+qD~iK z7)02tLW>RVdeFo?BTb65>&F#)EM7`=u(oOQN*Ehg8*Wr*UQHLD6#2fjY?JIpD`p&3 zLDSZ$WOe(KU6;>(E^g+o-SR=9_99ybN?&g7BHp>vvb?UvaaY4G+V75MwTV7}(YqONT$4;}cxgG8?2 zL8>+IEZ2v>7V-d!2ZDNTlnml63*93e3(-d1Y8aE&89TqA)`~}9P2qi%n>I!w<>^++ zjf@D}9#Eo2-rzo1*ms0Z?y diff --git a/docs/saml2/py-modindex.html b/docs/saml2/py-modindex.html deleted file mode 100644 index e7321859..00000000 --- a/docs/saml2/py-modindex.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - Python Class Index — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - - - -
-
-
-
- - -

Python Class Index

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- saml2 -
    - saml2.auth -
    - saml2.authn_request -
    - saml2.constants -
    - saml2.errors -
    - saml2.logout_request -
    - saml2.logout_response -
    - saml2.metadata -
    - saml2.response -
    - saml2.settings -
    - saml2.utils -
- - -
-
-
-
-
- - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/saml2.html b/docs/saml2/saml2.html deleted file mode 100644 index 6dd1e00a..00000000 --- a/docs/saml2/saml2.html +++ /dev/null @@ -1,2044 +0,0 @@ - - - - - - - - - - OneLogin saml2 Module — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - -
-
-
-
- -
-

OneLogin saml2 Module

-
-

auth Class

-
-
-class onelogin.saml2.auth.OneLogin_Saml2_Auth(request_data, old_settings=None)[source]
-

Bases: object

-
-
-build_request_signature(saml_request, relay_state)[source]
-

Builds the Signature of the SAML Request.

- --- - - - -
Parameters:
    -
  • saml_request (string) – The SAML Request
  • -
  • relay_state (string) – The target URL the user should be redirected to
  • -
-
-
- -
-
-build_response_signature(saml_response, relay_state)[source]
-

Builds the Signature of the SAML Response. -:param saml_request: The SAML Response -:type saml_request: string

- --- - - - -
Parameters:relay_state (string) – The target URL the user should be redirected to
-
- -
-
-get_attribute(name)[source]
-

Returns the requested SAML attribute.

- --- - - - - - - - -
Parameters:name (string) – Name of the attribute
Returns:Attribute value if exists or None
Return type:string
-
- -
-
-get_attributes()[source]
-

Returns the set of SAML attributes.

- --- - - - - - -
Returns:SAML attributes
Return type:dict
-
- -
-
-get_errors()[source]
-

Returns a list with code errors if something went wrong

- --- - - - - - -
Returns:List of errors
Return type:list
-
- -
-
-get_last_error_reason()[source]
-

Returns the reason for the last error

- --- - - - - - -
Returns:Error
Return type:string
-
- -
-
-get_nameid()[source]
-

Returns the nameID.

- --- - - - - - -
Returns:NameID
Return type:string
-
- -
-
-get_settings()[source]
-

Returns the settings info -:return: Setting info -:rtype: OneLogin_Saml2_Setting object

-
- -
-
-get_slo_url()[source]
-

Gets the SLO url.

- --- - - - - - -
Returns:An URL, the SLO endpoint of the IdP
Return type:string
-
- -
-
-get_sso_url()[source]
-

Gets the SSO url.

- --- - - - - - -
Returns:An URL, the SSO endpoint of the IdP
Return type:string
-
- -
-
-is_authenticated()[source]
-

Checks if the user is authenticated or not.

- --- - - - - - -
Returns:True if is authenticated, False if not
Return type:bool
-
- -
-
-login(return_to=None, force_authn=False, is_passive=False)[source]
-

Initiates the SSO process.

- --- - - - - - -
Parameters:
    -
  • return_to (string) – Optional argument. The target URL the user should be redirected to after login.
  • -
  • force_authn (bool) – Optional argument. When true the AuthNReuqest will set the ForceAuthn='true'.
  • -
  • is_passive (bool) – Optional argument. When true the AuthNReuqest will set the Ispassive='true'.
  • -
-
Returns:Redirection url
-
- -
-
-logout(return_to=None, name_id=None, session_index=None)[source]
-

Initiates the SLO process.

- --- - - - - - - -
Parameters:
    -
  • return_to (string) – Optional argument. The target URL the user should be redirected to after logout.
  • -
  • name_id (string) – Optional argument. The NameID that will be set in the LogoutRequest.
  • -
  • session_index (string) – Optional argument. SessionIndex that identifies the session of the user.
  • -
Returns:Redirection url
-
- -
-
-process_response(request_id=None)[source]
-

Process the SAML Response sent by the IdP.

- --- - - - - - -
Parameters:request_id (string) – Is an optional argumen. Is the ID of the AuthNRequest sent by this SP to the IdP.
Raises :OneLogin_Saml2_Error.SAML_RESPONSE_NOT_FOUND, when a POST with a SAMLResponse is not found
-
- -
-
-process_slo(keep_local_session=False, request_id=None, delete_session_cb=None)[source]
-

Process the SAML Logout Response / Logout Request sent by the IdP.

- --- - - - - - -
Parameters:
    -
  • keep_local_session (bool) – When false will destroy the local session, otherwise will destroy it
  • -
  • request_id (string) – The ID of the LogoutRequest sent by this SP to the IdP
  • -
-
Returns:

Redirection url

-
-
- -
-
-redirect_to(url=None, parameters={})[source]
-

Redirects the user to the url past by parameter or to the url that we defined in our SSO Request.

- --- - - - - - -
Parameters:
    -
  • url (string) – The target URL to redirect the user
  • -
  • parameters (dict) – Extra parameters to be passed as part of the url
  • -
-
Returns:

Redirection url

-
-
- -
-
-set_strict(value)[source]
-

Set the strict mode active/disable

- --- - - - -
Parameters:value (bool) –
-
- -
- -
-
-

authn_request Class

-
-
-class onelogin.saml2.authn_request.OneLogin_Saml2_Authn_Request(settings, force_authn=False, is_passive=False)[source]
-
-
-get_request()[source]
-

Returns unsigned AuthnRequest. -:return: Unsigned AuthnRequest -:rtype: str object

-
- -
- -
-
-

constants Class

-
-
-class onelogin.saml2.constants.OneLogin_Saml2_Constants[source]
-
-
-AC_KERBEROS = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Kerberos'
-
- -
-
-AC_PASSWORD = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Password'
-
- -
-
-AC_SMARTCARD = 'urn:oasis:names:tc:SAML:2.0:ac:classes:Smartcard'
-
- -
-
-AC_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified'
-
- -
-
-AC_X509 = 'urn:oasis:names:tc:SAML:2.0:ac:classes:X509'
-
- -
-
-ALOWED_CLOCK_DRIFT = 180
-
- -
-
-ATTRNAME_FORMAT_BASIC = 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic'
-
- -
-
-ATTRNAME_FORMAT_UNSPECIFIED = 'urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified'
-
- -
-
-ATTRNAME_FORMAT_URI = 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri'
-
- -
-
-BINDING_DEFLATE = 'urn:oasis:names:tc:SAML:2.0:bindings:URL-Encoding:DEFLATE'
-
- -
-
-BINDING_HTTP_ARTIFACT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact'
-
- -
-
-BINDING_HTTP_POST = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
-
- -
-
-BINDING_HTTP_REDIRECT = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'
-
- -
-
-BINDING_SOAP = 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'
-
- -
-
-CM_BEARER = 'urn:oasis:names:tc:SAML:2.0:cm:bearer'
-
- -
-
-CM_HOLDER_KEY = 'urn:oasis:names:tc:SAML:2.0:cm:holder-of-key'
-
- -
-
-CM_SENDER_VOUCHES = 'urn:oasis:names:tc:SAML:2.0:cm:sender-vouches'
-
- -
-
-NAMEID_EMAIL_ADDRESS = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress'
-
- -
-
-NAMEID_ENCRYPTED = 'urn:oasis:names:tc:SAML:2.0:nameid-format:encrypted'
-
- -
-
-NAMEID_ENTITY = 'urn:oasis:names:tc:SAML:2.0:nameid-format:entity'
-
- -
-
-NAMEID_KERBEROS = 'urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos'
-
- -
-
-NAMEID_PERSISTENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'
-
- -
-
-NAMEID_TRANSIENT = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient'
-
- -
-
-NAMEID_WINDOWS_DOMAIN_QUALIFIED_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName'
-
- -
-
-NAMEID_X509_SUBJECT_NAME = 'urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName'
-
- -
-
-NSMAP = {'xenc': 'http://www.w3.org/2001/04/xmlenc#', 'samlp': 'urn:oasis:names:tc:SAML:2.0:protocol', 'ds': 'http://www.w3.org/2000/09/xmldsig#', 'saml': 'urn:oasis:names:tc:SAML:2.0:assertion'}
-
- -
-
-NS_DS = 'http://www.w3.org/2000/09/xmldsig#'
-
- -
-
-NS_MD = 'urn:oasis:names:tc:SAML:2.0:metadata'
-
- -
-
-NS_SAML = 'urn:oasis:names:tc:SAML:2.0:assertion'
-
- -
-
-NS_SAMLP = 'urn:oasis:names:tc:SAML:2.0:protocol'
-
- -
-
-NS_SOAP = 'http://schemas.xmlsoap.org/soap/envelope/'
-
- -
-
-NS_XENC = 'http://www.w3.org/2001/04/xmlenc#'
-
- -
-
-NS_XS = 'http://www.w3.org/2001/XMLSchema'
-
- -
-
-NS_XSI = 'http://www.w3.org/2001/XMLSchema-instance'
-
- -
-
-RSA_SHA1 = 'http://www.w3.org/2000/09/xmldsig#rsa-sha1'
-
- -
-
-STATUS_NO_PASSIVE = 'urn:oasis:names:tc:SAML:2.0:status:NoPassive'
-
- -
-
-STATUS_PARTIAL_LOGOUT = 'urn:oasis:names:tc:SAML:2.0:status:PartialLogout'
-
- -
-
-STATUS_PROXY_COUNT_EXCEEDED = 'urn:oasis:names:tc:SAML:2.0:status:ProxyCountExceeded'
-
- -
-
-STATUS_REQUESTER = 'urn:oasis:names:tc:SAML:2.0:status:Requester'
-
- -
-
-STATUS_RESPONDER = 'urn:oasis:names:tc:SAML:2.0:status:Responder'
-
- -
-
-STATUS_SUCCESS = 'urn:oasis:names:tc:SAML:2.0:status:Success'
-
- -
-
-STATUS_VERSION_MISMATCH = 'urn:oasis:names:tc:SAML:2.0:status:VersionMismatch'
-
- -
- -
-
-

errors Class

-
-
-exception onelogin.saml2.errors.OneLogin_Saml2_Error(message, code=0, errors=None)[source]
-

Bases: exceptions.Exception

-
-
-METADATA_SP_INVALID = 3
-
- -
-
-PRIVATE_KEY_FILE_NOT_FOUND = 7
-
- -
-
-PUBLIC_CERT_FILE_NOT_FOUND = 6
-
- -
-
-REDIRECT_INVALID_URL = 5
-
- -
-
-SAML_LOGOUTMESSAGE_NOT_FOUND = 9
-
- -
-
-SAML_LOGOUTREQUEST_INVALID = 10
-
- -
-
-SAML_LOGOUTRESPONSE_INVALID = 11
-
- -
-
-SAML_RESPONSE_NOT_FOUND = 8
-
- -
-
-SAML_SINGLE_LOGOUT_NOT_SUPPORTED = 12
-
- -
-
-SETTINGS_FILE_NOT_FOUND = 0
-
- -
-
-SETTINGS_INVALID = 2
-
- -
-
-SETTINGS_INVALID_SYNTAX = 1
-
- -
-
-SP_CERTS_NOT_FOUND = 4
-
- -
- -
-
-

logout_request Class

-
-
-class onelogin.saml2.logout_request.OneLogin_Saml2_Logout_Request(settings, request=None, name_id=None, session_index=None)[source]
-
-
-static get_id(request)[source]
-

Returns the ID of the Logout Request -:param request: Logout Request Message -:type request: string|DOMDocument -:return: string ID -:rtype: str object

-
- -
-
-static get_issuer(request)[source]
-

Gets the Issuer of the Logout Request Message -:param request: Logout Request Message -:type request: string|DOMDocument -:return: The Issuer -:rtype: string

-
- -
-
-static get_name_id(request, key=None)[source]
-

Gets the NameID of the Logout Request Message -:param request: Logout Request Message -:type request: string|DOMDocument -:param key: The SP key -:type key: string -:return: Name ID Value -:rtype: string

-
- -
-
-static get_name_id_data(request, key=None)[source]
-

Gets the NameID Data of the the Logout Request -:param request: Logout Request Message -:type request: string|DOMDocument -:param key: The SP key -:type key: string -:return: Name ID Data (Value, Format, NameQualifier, SPNameQualifier) -:rtype: dict

-
- -
-
-get_request()[source]
-

Returns the Logout Request defated, base64encoded -:return: Deflated base64 encoded Logout Request -:rtype: str object

-
- -
-
-static get_session_indexes(request)[source]
-

Gets the SessionIndexes from the Logout Request -:param request: Logout Request Message -:type request: string|DOMDocument -:return: The SessionIndex value -:rtype: list

-
- -
-
-static is_valid(settings, request, get_data, debug=False)[source]
-

Checks if the Logout Request recieved is valid -:param settings: Settings -:type settings: OneLogin_Saml2_Settings -:param request: Logout Request Message -:type request: string|DOMDocument -:return: If the Logout Request is or not valid -:rtype: boolean

-
- -
-
-get_error()[source]
-

After execute a validation process, if fails this method returns the cause -:rtype: str object

-
- -
- -
-
-

logout_response Class

-
-
-class onelogin.saml2.logout_response.OneLogin_Saml2_Logout_Response(settings, response=None)[source]
-
-
-build(in_response_to)[source]
-

Creates a Logout Response object. -:param in_response_to: InResponseTo value for the Logout Response. -:type in_response_to: string

-
- -
-
-get_issuer()[source]
-

Gets the Issuer of the Logout Response Message -:return: The Issuer -:rtype: string

-
- -
-
-get_response()[source]
-

Returns a Logout Response object. -:return: Logout Response deflated and base64 encoded -:rtype: string

-
- -
-
-get_status()[source]
-

Gets the Status -:return: The Status -:rtype: string

-
- -
-
-is_valid(request_data, request_id=None)[source]
-

Determines if the SAML LogoutResponse is valid -:param request_id: The ID of the LogoutRequest sent by this SP to the IdP -:type request_id: string -:return: Returns if the SAML LogoutResponse is or not valid -:rtype: boolean

-
- -
-
-get_error()[source]
-

After execute a validation process, if fails this method returns the cause -:rtype: str object

-
- -
- -
-
-

metadata Class

-
-
-class onelogin.saml2.metadata.OneLogin_Saml2_Metadata[source]
-
-
-TIME_CACHED = 604800
-
- -
-
-TIME_VALID = 172800
-
- -
-
-static add_x509_key_descriptors(metadata, cert)[source]
-

Add the x509 descriptors (sign/encriptation to the metadata -The same cert will be used for sign/encrypt

- --- - - - - - - - -
Parameters:
    -
  • metadata (string) – SAML Metadata XML
  • -
  • cert (string) – x509 cert
  • -
-
Returns:

Metadata with KeyDescriptors

-
Return type:

string

-
-
- -
-
-static builder(sp, authnsign=False, wsign=False, valid_until=None, cache_duration=None, contacts=None, organization=None)[source]
-

Build the metadata of the SP

- --- - - - -
Parameters:
    -
  • sp (string) – The SP data
  • -
  • authnsign (string) – authnRequestsSigned attribute
  • -
  • wsign (string) – wantAssertionsSigned attribute
  • -
  • valid_until (DateTime) – Metadata’s valid time
  • -
  • cache_duration (Timestamp) – Duration of the cache in seconds
  • -
  • contacts (dict) – Contacts info
  • -
  • organization (dict) – Organization ingo
  • -
-
-
- -
-
-static sign_metadata(metadata, key, cert)[source]
-

Sign the metadata with the key/cert provided

- --- - - - - - - - -
Parameters:
    -
  • metadata (string) – SAML Metadata XML
  • -
  • key (string) – x509 key
  • -
  • cert (string) – x509 cert
  • -
-
Returns:

Signed Metadata

-
Return type:

string

-
-
- -
- -
-
-

response Class

-
-
-class onelogin.saml2.response.OneLogin_Saml2_Response(settings, response)[source]
-

Bases: object

-
-
-check_status()[source]
-

Check if the status of the response is success or not

- --- - - - -
Raises :Exception. If the status is not success
-
- -
-
-get_attributes()[source]
-

Gets the Attributes from the AttributeStatement element. -EncryptedAttributes are not supported

-
- -
-
-get_audiences()[source]
-

Gets the audiences

- --- - - - - - -
Returns:The valid audiences for the SAML Response
Return type:list
-
- -
-
-get_issuers()[source]
-

Gets the issuers (from message and from assertion)

- --- - - - - - -
Returns:The issuers
Return type:list
-
- -
-
-get_nameid()[source]
-

Gets the NameID provided by the SAML Response from the IdP

- --- - - - - - -
Returns:NameID (value)
Return type:string
-
- -
-
-get_nameid_data()[source]
-

Gets the NameID Data provided by the SAML Response from the IdP

- --- - - - - - -
Returns:Name ID Data (Value, Format, NameQualifier, SPNameQualifier)
Return type:dict
-
- -
-
-get_session_index()[source]
-

Gets the SessionIndex from the AuthnStatement -Could be used to be stored in the local session in order -to be used in a future Logout Request that the SP could -send to the SP, to set what specific session must be deleted

- --- - - - - - -
Returns:The SessionIndex value
Return type:string|None
-
- -
-
-get_session_not_on_or_after()[source]
-

Gets the SessionNotOnOrAfter from the AuthnStatement -Could be used to set the local session expiration

- --- - - - - - -
Returns:The SessionNotOnOrAfter value
Return type:time|None
-
- -
-
-is_valid(request_data, request_id=None)[source]
-

Constructs the response object.

- --- - - - - - - - -
Parameters:request_id (string) – Optional argument. The ID of the AuthNRequest sent by this SP to the IdP
Returns:True if the SAML Response is valid, False if not
Return type:bool
-
- -
-
-validate_num_assertions()[source]
-

Verifies that the document only contains a single Assertion (encrypted or not)

- --- - - - - - -
Returns:True if only 1 assertion encrypted or not
Return type:bool
-
- -
-
-validate_timestamps()[source]
-

Verifies that the document is valid according to Conditions Element

- --- - - - - - -
Returns:True if the condition is valid, False otherwise
Return type:bool
-
- -
- -
-
-

settings Class

-
-
-class onelogin.saml2.settings.OneLogin_Saml2_Settings(settings=None, custom_base_path=None)[source]
-
-
-check_settings(settings)[source]
-

Checks the settings info.

- --- - - - - - - - -
Parameters:settings (dict) – Dict with settings data
Returns:Errors found on the settings data
Return type:list
-
- -
-
-check_sp_certs()[source]
-

Checks if the x509 certs of the SP exists and are valid.

- --- - - - - - -
Returns:If the x509 certs of the SP exists and are valid
Return type:boolean
-
- -
-
-format_idp_cert()[source]
-

Formats the IdP cert.

-
- -
-
-get_base_path()[source]
-

Returns base path

- --- - - - - - -
Returns:The base toolkit folder path
Return type:string
-
- -
-
-get_cert_path()[source]
-

Returns cert path

- --- - - - - - -
Returns:The cert folder path
Return type:string
-
- -
-
-get_contacts()[source]
-

Gets contact data.

- --- - - - - - -
Returns:Contacts info
Return type:dict
-
- -
-
-get_errors()[source]
-

Returns an array with the errors, the array is empty when the settings is ok.

- --- - - - - - -
Returns:Errors
Return type:list
-
- -
-
-get_ext_lib_path()[source]
-

Returns external lib path

- --- - - - - - -
Returns:The external library folder path
Return type:string
-
- -
-
-get_idp_data()[source]
-

Gets the IdP data.

- --- - - - - - -
Returns:IdP info
Return type:dict
-
- -
-
-get_lib_path()[source]
-

Returns lib path

- --- - - - - - -
Returns:The library folder path
Return type:string
-
- -
-
-get_organization()[source]
-

Gets organization data.

- --- - - - - - -
Returns:Organization info
Return type:dict
-
- -
-
-get_schemas_path()[source]
-

Returns schema path

- --- - - - - - -
Returns:The schema folder path
Return type:string
-
- -
-
-get_security_data()[source]
-

Gets security data.

- --- - - - - - -
Returns:Security info
Return type:dict
-
- -
-
-get_sp_cert()[source]
-

Returns the x509 public cert of the SP.

- --- - - - - - -
Returns:SP public cert
Return type:string
-
- -
-
-get_sp_data()[source]
-

Gets the SP data.

- --- - - - - - -
Returns:SP info
Return type:dict
-
- -
-
-get_sp_key()[source]
-

Returns the x509 private key of the SP.

- --- - - - - - -
Returns:SP private key
Return type:string
-
- -
-
-get_sp_metadata()[source]
-

Gets the SP metadata. The XML representation.

- --- - - - - - -
Returns:SP metadata (xml)
Return type:string
-
- -
-
-is_debug_active()[source]
-

Returns if the debug is active.

- --- - - - - - -
Returns:Debug parameter
Return type:boolean
-
- -
-
-is_strict()[source]
-

Returns if the ‘strict’ mode is active.

- --- - - - - - -
Returns:Strict parameter
Return type:boolean
-
- -
-
-set_strict(value)[source]
-

Activates or deactivates the strict mode.

- --- - - - -
Parameters:xml (boolean) – Strict parameter
-
- -
-
-validate_metadata(xml)[source]
-

Validates an XML SP Metadata.

- --- - - - - - - - -
Parameters:xml (string) – Metadata’s XML that will be validate
Returns:The list of found errors
Return type:list
-
- -
- -
-
-onelogin.saml2.settings.validate_url(url)[source]
-
- -
-
-

utils Class

-
-
-class onelogin.saml2.utils.OneLogin_Saml2_Utils[source]
-
-
-static add_sign(xml, key, cert)[source]
-

Adds signature key and senders certificate to an element (Message or -Assertion).

- --- - - - - - - - - - -
Parameters:
    -
  • xml – The element we should sign
  • -
  • key – The private key
  • -
  • cert – The public
  • -
-
Type :

string | Document

-
Type :

string

-
Type :

string

-
-
- -
-
-static calculate_x509_fingerprint(x509_cert)[source]
-

Calculates the fingerprint of a x509cert.

- --- - - - - - - - - - -
Parameters:x509_cert – x509 cert
Type :string
Returns:Formated fingerprint
Return type:string
-
- -
-
-static decode_base64_and_inflate(value)[source]
-

base64 decodes and then inflates according to RFC1951 -:param value: a deflated and encoded string -:return: the string after decoding and inflating

-
- -
-
-static decrypt_element(encrypted_data, enc_ctx)[source]
-

Decrypts an encrypted element.

- --- - - - - - - - - - - - -
Parameters:
    -
  • encrypted_data – The encrypted data.
  • -
  • enc_ctx – The encryption context.
  • -
-
Type :

DOMElement

-
Type :

Encryption Context

-
Returns:

The decrypted element.

-
Return type:

DOMElement

-
-
- -
-
-static deflate_and_base64_encode(value)[source]
-

Deflates and the base64 encodes a string -:param value: The string to deflate and encode -:return: The deflated and encoded string

-
- -
-
-static delete_local_session(callback=None)[source]
-

Deletes the local session.

-
- -
-
-static format_cert(cert, heads=True)[source]
-

Returns a x509 cert (adding header & footer if required).

- --- - - - - - - - - - - - -
Parameters:
    -
  • cert – A x509 unformated cert
  • -
  • heads – True if we want to include head and footer
  • -
-
Type :

string

-
Type :

boolean

-
Returns:

Formated cert

-
Return type:

string

-
-
- -
-
-static format_finger_print(fingerprint)[source]
-

Formates a fingerprint.

- --- - - - - - - - - - -
Parameters:fingerprint – fingerprint
Type :string
Returns:Formated fingerprint
Return type:string
-
- -
-
-static generate_name_id(value, sp_nq, sp_format, key=None)[source]
-

Generates a nameID.

- --- - - - - - - - - - - - - - - - -
Parameters:
    -
  • value – fingerprint
  • -
  • sp_nq – SP Name Qualifier
  • -
  • sp_format – SP Format
  • -
  • key – SP Key to encrypt the nameID
  • -
-
Type :

string

-
Type :

string

-
Type :

string

-
Type :

string

-
Returns:

DOMElement | XMLSec nameID

-
Return type:

string

-
-
- -
-
-static generate_unique_id()[source]
-

Generates an unique string (used for example as ID for assertions).

- --- - - - - - -
Returns:A unique string
Return type:string
-
- -
-
-static get_expire_time(cache_duration=None, valid_until=None)[source]
-

Compares 2 dates and returns the earliest.

- --- - - - - - - - - - - - -
Parameters:
    -
  • cache_duration – The duration, as a string.
  • -
  • valid_until – The valid until date, as a string or as a timestamp
  • -
-
Type :

string

-
Type :

string

-
Returns:

The expiration time.

-
Return type:

int

-
-
- -
-
-static get_self_host(request_data)[source]
-

Returns the current host.

- --- - - - - - - - - - -
Parameters:request_data – The request as a dict
Type :dict
Returns:The current host
Return type:string
-
- -
-
-static get_self_url(request_data)[source]
-

Returns the URL of the current host + current view + query.

- --- - - - - - - - - - -
Parameters:request_data – The request as a dict
Type :dict
Returns:The url of current host + current view + query
Return type:string
-
- -
-
-static get_self_url_host(request_data)[source]
-

Returns the protocol + the current host + the port (if different than -common ports).

- --- - - - - - - - - - -
Parameters:request_data – The request as a dict
Type :dict
Returns:Url
Return type:string
-
- -
-
-static get_self_url_no_query(request_data)[source]
-

Returns the URL of the current host + current view.

- --- - - - - - - - - - -
Parameters:request_data – The request as a dict
Type :dict
Returns:The url of current host + current view
Return type:string
-
- -
-
-static get_status(dom)[source]
-

Gets Status from a Response.

- --- - - - - - - - - - -
Parameters:dom – The Response as XML
Type :Document
Returns:The Status, an array with the code and a message.
Return type:dict
-
- -
-
-static is_https(request_data)[source]
-

Checks if https or http.

- --- - - - - - - - - - -
Parameters:request_data – The request as a dict
Type :dict
Returns:False if https is not active
Return type:boolean
-
- -
-
-static parse_SAML_to_time(timestr)[source]
-

Converts a SAML2 timestamp on the form yyyy-mm-ddThh:mm:ss(.s+)?Z -to a UNIX timestamp. The sub-second part is ignored.

- --- - - - - - - - - - -
Parameters:time – The time we should convert (SAML Timestamp).
Type :string
Returns:Converted to a unix timestamp.
Return type:int
-
- -
-
-static parse_duration(duration, timestamp=None)[source]
-

Interprets a ISO8601 duration value relative to a given timestamp.

- --- - - - - - - - - - - - -
Parameters:
    -
  • duration – The duration, as a string.
  • -
  • timestamp – The unix timestamp we should apply the duration to. -Optional, default to the current time.
  • -
-
Type :

string

-
Type :

string

-
Returns:

The new timestamp, after the duration is applied.

-
Return type:

int

-
-
- -
-
-static parse_time_to_SAML(time)[source]
-

Converts a UNIX timestamp to SAML2 timestamp on the form -yyyy-mm-ddThh:mm:ss(.s+)?Z.

- --- - - - - - - - - - -
Parameters:time – The time we should convert (DateTime).
Type :string
Returns:SAML2 timestamp.
Return type:string
-
- -
-
-static query(dom, query, context=None)[source]
-

Extracts nodes that match the query from the Element

- --- - - - - - - - - - - - - - -
Parameters:
    -
  • dom – The root of the lxml objet
  • -
  • query – Xpath Expresion
  • -
  • context – Context Node
  • -
-
Type :

Element

-
Type :

string

-
Type :

DOMElement

-
Returns:

The queried nodes

-
Return type:

list

-
-
- -
-
-static redirect(url, parameters={}, request_data={})[source]
-

Executes a redirection to the provided url (or return the target url).

- --- - - - - - - - - - - - - - -
Parameters:
    -
  • url – The target url
  • -
  • parameters – Extra parameters to be passed as part of the url
  • -
  • request_data – The request as a dict
  • -
-
Type :

string

-
Type :

dict

-
Type :

dict

-
Returns:

Url

-
Return type:

string

-
-
- -
-
-static validate_sign(xml, cert=None, fingerprint=None)[source]
-

Validates a signature (Message or Assertion).

- --- - - - - - - - - - -
Parameters:
    -
  • xml – The element we should validate
  • -
  • cert – The pubic cert
  • -
  • fingerprint – The fingerprint of the public cert
  • -
-
Type :

string | Document

-
Type :

string

-
Type :

string

-
-
- -
-
-static validate_xml(xml, schema, debug=False)[source]
-
- -
-
-static write_temp_file(content)[source]
-

Writes some content into a temporary file and returns it.

- --- - - - - - - - - - -
Parameters:content – The file content
Type :string
Returns:The temporary file
Return type:file-like object
-
- -
- -
-
- - -
-
-
-
-
-

Table Of Contents

- - -

Previous topic

-

Welcome to OneLogin SAML Python library documentation

-

This Page

- - - -
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/search.html b/docs/saml2/search.html deleted file mode 100644 index 531d00de..00000000 --- a/docs/saml2/search.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - - - Search — OneLogin SAML Python library classes and methods - - - - - - - - - - - - - - - - - - - -
-
-
-
- -

Search

-
- -

- Please activate JavaScript to enable the search - functionality. -

-
-

- From here you can search these documents. Enter your search - words into the box below and click "search". Note that the search - function will automatically search for all of the words. Pages - containing fewer words won't appear in the result list. -

-
- - - -
- -
- -
- -
-
-
-
-
-
-
-
-
- - - - \ No newline at end of file diff --git a/docs/saml2/searchindex.js b/docs/saml2/searchindex.js deleted file mode 100644 index cf3c42ca..00000000 --- a/docs/saml2/searchindex.js +++ /dev/null @@ -1 +0,0 @@ -Search.setIndex({objects:{"saml2.logout_response.OneLogin_Saml2_Logout_Response":{is_valid:[1,2,1,""],get_response:[1,2,1,""],get_status:[1,2,1,""],get_issuer:[1,2,1,""],build:[1,2,1,""]},"saml2.response.OneLogin_Saml2_Response":{get_audiences:[1,2,1,""],validate_num_assertions:[1,2,1,""],get_nameid_data:[1,2,1,""],get_session_index:[1,2,1,""],get_issuers:[1,2,1,""],is_valid:[1,2,1,""],check_status:[1,2,1,""],validate_timestamps:[1,2,1,""],get_nameid:[1,2,1,""],get_attributes:[1,2,1,""],get_session_not_on_or_after:[1,2,1,""]},"saml2.errors.OneLogin_Saml2_Error":{PUBLIC_CERT_FILE_NOT_FOUND:[1,1,1,""],SETTINGS_FILE_NOT_FOUND:[1,1,1,""],SAML_LOGOUTREQUEST_INVALID:[1,1,1,""],REDIRECT_INVALID_URL:[1,1,1,""],PRIVATE_KEY_FILE_NOT_FOUND:[1,1,1,""],SAML_LOGOUTMESSAGE_NOT_FOUND:[1,1,1,""],SAML_RESPONSE_NOT_FOUND:[1,1,1,""],METADATA_SP_INVALID:[1,1,1,""],SAML_LOGOUTRESPONSE_INVALID:[1,1,1,""],SETTINGS_INVALID:[1,1,1,""],SP_CERTS_NOT_FOUND:[1,1,1,""],SETTINGS_INVALID_SYNTAX:[1,1,1,""],SAML_SINGLE_LOGOUT_NOT_SUPPORTED:[1,1,1,""]},"saml2.errors":{OneLogin_Saml2_Error:[1,6,1,""]},"saml2.metadata.OneLogin_Saml2_Metadata":{sign_metadata:[1,3,1,""],builder:[1,3,1,""],add_x509_key_descriptors:[1,3,1,""],TIME_VALID:[1,1,1,""],TIME_CACHED:[1,1,1,""]},"saml2.response":{OneLogin_Saml2_Response:[1,4,1,""]},"saml2.settings.OneLogin_Saml2_Settings":{get_contacts:[1,2,1,""],get_security_data:[1,2,1,""],validate_metadata:[1,2,1,""],get_errors:[1,2,1,""],check_settings:[1,2,1,""],get_sp_data:[1,2,1,""],get_idp_data:[1,2,1,""],get_cert_path:[1,2,1,""],get_schemas_path:[1,2,1,""],set_strict:[1,2,1,""],get_base_path:[1,2,1,""],is_strict:[1,2,1,""],get_lib_path:[1,2,1,""],get_sp_key:[1,2,1,""],get_sp_metadata:[1,2,1,""],is_debug_active:[1,2,1,""],get_ext_lib_path:[1,2,1,""],get_sp_cert:[1,2,1,""],get_organization:[1,2,1,""],check_sp_certs:[1,2,1,""],format_idp_cert:[1,2,1,""]},"saml2.settings":{OneLogin_Saml2_Settings:[1,4,1,""],validate_url:[1,5,1,""]},"saml2.logout_response":{OneLogin_Saml2_Logout_Response:[1,4,1,""]},"saml2.authn_request.OneLogin_Saml2_Authn_Request":{get_request:[1,2,1,""]},"saml2.constants.OneLogin_Saml2_Constants":{NAMEID_EMAIL_ADDRESS:[1,1,1,""],CM_SENDER_VOUCHES:[1,1,1,""],CM_HOLDER_KEY:[1,1,1,""],NS_SAML:[1,1,1,""],RSA_SHA1:[1,1,1,""],NS_XS:[1,1,1,""],STATUS_PROXY_COUNT_EXCEEDED:[1,1,1,""],NS_SOAP:[1,1,1,""],NAMEID_ENCRYPTED:[1,1,1,""],STATUS_REQUESTER:[1,1,1,""],STATUS_NO_PASSIVE:[1,1,1,""],STATUS_PARTIAL_LOGOUT:[1,1,1,""],BINDING_HTTP_REDIRECT:[1,1,1,""],NAMEID_X509_SUBJECT_NAME:[1,1,1,""],AC_KERBEROS:[1,1,1,""],NAMEID_KERBEROS:[1,1,1,""],BINDING_HTTP_ARTIFACT:[1,1,1,""],NS_XENC:[1,1,1,""],BINDING_HTTP_POST:[1,1,1,""],CM_BEARER:[1,1,1,""],ALOWED_CLOCK_DRIFT:[1,1,1,""],BINDING_DEFLATE:[1,1,1,""],NAMEID_ENTITY:[1,1,1,""],AC_SMARTCARD:[1,1,1,""],AC_UNSPECIFIED:[1,1,1,""],NS_XSI:[1,1,1,""],NSMAP:[1,1,1,""],STATUS_RESPONDER:[1,1,1,""],AC_PASSWORD:[1,1,1,""],NS_SAMLP:[1,1,1,""],NS_DS:[1,1,1,""],STATUS_SUCCESS:[1,1,1,""],AC_X509:[1,1,1,""],NAMEID_TRANSIENT:[1,1,1,""],BINDING_SOAP:[1,1,1,""],ATTRNAME_FORMAT_UNSPECIFIED:[1,1,1,""],ATTRNAME_FORMAT_BASIC:[1,1,1,""],NS_MD:[1,1,1,""],ATTRNAME_FORMAT_URI:[1,1,1,""],NAMEID_PERSISTENT:[1,1,1,""],STATUS_VERSION_MISMATCH:[1,1,1,""],NAMEID_WINDOWS_DOMAIN_QUALIFIED_NAME:[1,1,1,""]},"saml2.authn_request":{OneLogin_Saml2_Authn_Request:[1,4,1,""]},"saml2.metadata":{OneLogin_Saml2_Metadata:[1,4,1,""]},"saml2.utils.OneLogin_Saml2_Utils":{generate_unique_id:[1,3,1,""],add_sign:[1,3,1,""],deflate_and_base64_encode:[1,3,1,""],get_status:[1,3,1,""],query:[1,3,1,""],redirect:[1,3,1,""],get_expire_time:[1,3,1,""],decode_base64_and_inflate:[1,3,1,""],parse_SAML_to_time:[1,3,1,""],parse_duration:[1,3,1,""],generate_name_id:[1,3,1,""],validate_xml:[1,3,1,""],get_self_host:[1,3,1,""],parse_time_to_SAML:[1,3,1,""],format_finger_print:[1,3,1,""],decrypt_element:[1,3,1,""],get_self_url_host:[1,3,1,""],get_self_url:[1,3,1,""],delete_local_session:[1,3,1,""],format_cert:[1,3,1,""],is_https:[1,3,1,""],calculate_x509_fingerprint:[1,3,1,""],get_self_url_no_query:[1,3,1,""],write_temp_file:[1,3,1,""],validate_sign:[1,3,1,""]},"saml2.logout_request.OneLogin_Saml2_Logout_Request":{get_issuer:[1,3,1,""],get_name_id:[1,3,1,""],get_request:[1,2,1,""],get_id:[1,3,1,""],is_valid:[1,3,1,""],get_session_indexes:[1,3,1,""],get_name_id_data:[1,3,1,""]},"saml2.utils":{OneLogin_Saml2_Utils:[1,4,1,""]},"saml2.constants":{OneLogin_Saml2_Constants:[1,4,1,""]},"saml2.auth.OneLogin_Saml2_Auth":{get_settings:[1,2,1,""],process_response:[1,2,1,""],get_errors:[1,2,1,""],build_request_signature:[1,2,1,""],redirect_to:[1,2,1,""],is_authenticated:[1,2,1,""],get_attribute:[1,2,1,""],build_response_signature:[1,2,1,""],set_strict:[1,2,1,""],process_slo:[1,2,1,""],get_sso_url:[1,2,1,""],logout:[1,2,1,""],login:[1,2,1,""],get_slo_url:[1,2,1,""],get_attributes:[1,2,1,""],get_nameid:[1,2,1,""]},"saml2.auth":{OneLogin_Saml2_Auth:[1,4,1,""]},saml2:{errors:[1,0,1,""],settings:[1,0,1,""],utils:[1,0,1,""],auth:[1,0,1,""],logout_request:[1,0,1,""],authn_request:[1,0,1,""],logout_response:[1,0,1,""],response:[1,0,1,""],constants:[1,0,1,""],metadata:[1,0,1,""]},"saml2.logout_request":{OneLogin_Saml2_Logout_Request:[1,4,1,""]}},terms:{represent:1,code:1,queri:1,issuer:1,privat:1,encryptedattribut:1,base64:1,ac_smartcard:1,specif:1,send:1,binding_defl:1,must:1,sent:1,deactiv:1,sourc:1,string:1,fals:1,parse_saml_to_tim:1,util:[0,1],xmlschema:1,public_cert_file_not_found:1,get_self_url_no_queri:1,settings_file_not_found:1,list:1,onelogin_saml2_util:1,sign_metadata:1,pubic:1,sign:1,past:1,second:1,pass:1,port:1,index:0,what:1,get_name_id:1,compar:1,get_idp_data:1,sp_nq:1,current:1,delet:1,x509subjectnam:1,"new":1,status_no_pass:1,"public":1,metadata:[0,1],redirect:1,keep_local_sess:1,gener:1,windowsdomainqualifiednam:1,logout:1,path:1,valu:1,search:0,sender:1,datetim:1,cert:1,is_debug_act:1,redirect_invalid_url:1,extra:1,appli:1,modul:[0,1],metadata_sp_invalid:1,is_authent:1,unix:1,"boolean":1,onelogin_saml2_respons:1,org:1,post:1,authnstat:1,from:1,ddthh:1,nameid_persist:1,emailaddress:1,status_request:1,type:1,until:1,keydescriptor:1,attrname_format_bas:1,iso8601:1,"transient":1,get_sp_cert:1,cach:1,status_proxy_count_exceed:1,none:1,endpoint:1,redirect_to:1,uniqu:1,descriptor:1,time_valid:1,root:1,status_success:1,request_data:1,objet:1,process:1,onelogin_saml2_auth:1,unform:1,indic:0,ac_unspecifi:1,want:1,unsign:1,lxml:1,secur:1,check_statu:1,status_respond:1,write:1,verifi:1,decrypt_el:1,ns_samlp:1,ac_x509:1,x509:1,after:1,validate_xml:1,nameid_x509_subject_nam:1,callback:1,date:1,data:1,domdocu:1,footer:1,bind:1,element:1,onelogin_saml2_logout_request:1,authn_request:[0,1],nameid:1,order:1,alowed_clock_drift:1,deflate_and_base64_encod:1,process_respons:1,paramet:1,settings_invalid_syntax:1,persist:1,get_slo_url:1,"return":1,timestamp:1,auth:[0,1],authnrequest:1,get_respons:1,get_self_url:1,format_idp_cert:1,namequalifi:1,authent:1,onelogin_saml2_authn_request:1,mode:1,request_id:1,debug:1,found:1,went:1,oasi:1,authnsign:1,"static":1,rsa_sha1:1,our:1,extract:1,check_sp_cert:1,content:[0,1],validate_metadata:1,rel:1,qualifi:1,generate_name_id:1,envelop:1,given:1,base:1,get_lib_path:1,format_finger_print:1,get_session_index:1,earliest:1,get_name_id_data:1,ns_x:1,could:1,wrong:1,domel:1,ns_d:1,time_cach:1,validate_sign:1,smartcard:1,arrai:1,messag:1,attrname_format_uri:1,kerbero:1,saml_single_logout_not_support:1,differ:1,construct:1,ns_xsi:1,parse_time_to_saml:1,store:1,schema:1,option:1,sessionnotonoraft:1,rsa:1,artifact:1,wantassertionssign:1,encrypted_data:1,vouch:1,part:1,is_strict:1,holder:1,than:1,target:1,provid:1,defat:1,str:1,get_nameid:1,initi:1,argument:1,packag:[0,1],expir:1,onelogin_saml2_error:1,tabl:0,onelogin_saml2_set:1,lib:1,build_response_signatur:1,destroi:1,contact:1,build:1,soap:1,singl:1,validate_timestamp:1,decode_base64_and_infl:1,object:1,nameid_kerbero:1,logout_request:[0,1],return_to:1,"class":1,sub:1,ns_saml:1,saml_logoutrequest_invalid:1,dom:1,url:1,urn:1,nsmap:1,uri:1,determin:1,saml_response_not_found:1,add_sign:1,session:1,nameid_ent:1,onelogin_saml2_const:1,xml:1,onli:1,get_sp_kei:1,timestr:1,activ:1,set_strict:1,should:1,get_sso_url:1,dict:1,folder:1,local:1,valid_until:1,nameid_transi:1,get:1,authnrequestssign:1,sso:1,expres:1,get_nameid_data:1,requir:1,organ:1,onelogin:[0,1],binding_http_redirect:1,common:1,contain:1,xmlenc:1,view:1,respond:1,certif:1,set:[0,1],get_set:1,respons:[0,1],statu:1,ingo:1,logoutrequest:1,check_set:1,someth:1,get_organ:1,saml_logoutresponse_invalid:1,entiti:1,attribut:1,signatur:1,accord:1,kei:1,samlrespons:1,old_set:1,wsign:1,sp_format:1,delete_session_cb:1,rtype:1,get_cert_path:1,format_cert:1,audienc:1,instanc:1,get_error:1,attrnam:1,login:1,validate_num_assert:1,generate_unique_id:1,settings_invalid:1,write_temp_fil:1,status_partial_logout:1,header:1,rfc1951:1,reciev:1,empti:1,interpret:1,basic:1,nameid_email_address:1,partiallogout:1,convert:1,assert:1,get_id:1,versionmismatch:1,saml_request:1,durat:1,defin:1,calcul:1,slo:1,error:[0,1],ns_xenc:1,cm_holder_kei:1,get_attribut:1,binding_soap:1,toolkit:1,sessionindex:1,cache_dur:1,sp_certs_not_found:1,get_statu:1,status_version_mismatch:1,welcom:0,saml:1,inresponseto:1,process_slo:1,same:1,decod:1,document:[0,1],get_security_data:1,http:1,context:1,inflat:1,onelogin_saml2_logout_respons:1,rais:1,temporari:1,user:1,binding_http_artifact:1,extern:1,get_self_url_host:1,sha1:1,builder:1,relay_st:1,calculate_x509_fingerprint:1,exampl:1,thi:1,get_contact:1,protocol:1,bearer:1,execut:1,private_key_file_not_found:1,fingerprint:1,ac_kerbero:1,get_audi:1,get_sp_data:1,except:1,param:1,proxycountexceed:1,add:1,is_valid:1,xenc:1,match:1,logoutrespons:1,nameid_encrypt:1,format:1,add_x509_key_descriptor:1,cm_sender_vouch:1,get_sp_metadata:1,password:1,enc_ctx:1,name:1,like:1,success:1,xmlsoap:1,nameid_windows_domain_qualified_nam:1,page:0,yyyi:1,is_http:1,www:1,some:1,unspecifi:1,librari:1,xmldsig:1,condit:1,get_ext_lib_path:1,get_expire_tim:1,cm_bearer:1,build_request_signatur:1,logout_respons:[0,1],host:1,get_base_path:1,x509cert:1,deflat:1,idp:1,get_request:1,disabl:1,encod:1,get_issu:1,validate_url:1,samlp:1,support:1,strict:1,encript:1,includ:1,delete_local_sess:1,xpath:1,head:1,form:1,spnamequalifi:1,saml_logoutmessage_not_found:1,parse_dur:1,ac_password:1,"true":1,info:1,binding_http_post:1,get_session_not_on_or_aft:1,"default":1,ns_md:1,otherwis:1,constant:[0,1],creat:1,"int":1,request:1,decrypt:1,onelogin_saml2_metadata:1,exist:1,file:1,check:1,saml2:[0,1],encrypt:1,attrname_format_unspecifi:1,get_schemas_path:1,get_data:1,when:1,valid:1,bool:1,futur:1,saml_respons:1,argumen:1,node:1,attributestat:1,get_self_host:1,x509_cert:1,nopass:1,ns_soap:1,xmlsec:1,ignor:1,base64encod:1,time:1,custom_base_path:1,in_response_to:1},objtypes:{"0":"py:module","1":"py:attribute","2":"py:method","3":"py:staticmethod","4":"py:class","5":"py:function","6":"py:exception"},titles:["Welcome to saml2’s documentation!","OneLogin saml2 Module"],objnames:{"0":["py","module","Python module"],"1":["py","attribute","Python attribute"],"2":["py","method","Python method"],"3":["py","staticmethod","Python static method"],"4":["py","class","Python class"],"5":["py","function","Python function"],"6":["py","exception","Python exception"]},filenames:["index","saml2"]}) \ No newline at end of file