Changeset 6911
- Timestamp:
- 01/06/10 08:56:23 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/ndg_saml/ndg/saml/saml2/core.py
r6906 r6911 39 39 40 40 class Attribute(SAMLObject): 41 '''SAML 2.0 Core Attribute. 41 '''SAML 2.0 Core Attribute 42 42 43 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Local name of the Attribute element. 43 44 @type DEFAULT_ELEMENT_LOCAL_NAME: string … … 2104 2105 @type DEFAULT_ELEMENT_LOCAL_NAME: string 2105 2106 @cvar DEFAULT_ELEMENT_NAME: Default element name. 2106 @type DEFAULT_ELEMENT_NAME: string2107 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 2107 2108 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 2108 2109 @type TYPE_LOCAL_NAME: string 2109 2110 @cvar TYPE_NAME: QName of the XSI type. 2110 @type TYPE_NAME: string2111 @type TYPE_NAME: ndg.saml.common.xml.QName 2111 2112 2112 2113 @ivar __unknownChildren: unknown child elements … … 2192 2193 2193 2194 class StatusMessage(SAMLObject): 2194 '''Implementation of SAML 2.0 Status Message''' 2195 '''Implementation of SAML 2.0 Status Message 2196 2197 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Local name of the Status message element 2198 @type DEFAULT_ELEMENT_LOCAL_NAME: string 2199 @cvar DEFAULT_ELEMENT_NAME: Default element name 2200 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 2201 2202 @ivar __value: message text 2203 @type __value: basestring 2204 ''' 2195 2205 2196 2206 DEFAULT_ELEMENT_LOCAL_NAME = "StatusMessage" … … 2204 2214 super(StatusMessage, self).__init__(**kw) 2205 2215 2206 # Value attribute URI.2216 # message text 2207 2217 self.__value = None 2208 2218 … … 2213 2223 @rtype: dict 2214 2224 ''' 2215 2216 2225 _dict = super(StatusMessage, self).__getstate__() 2217 2226 for attrName in StatusMessage.__slots__: … … 2226 2235 2227 2236 def _getValue(self): 2237 ''' 2238 @return: message text 2239 @rtype: basestring 2240 ''' 2228 2241 return self.__value 2229 2242 2230 2243 def _setValue(self, value): 2244 ''' 2245 @param __value: message text 2246 @type __value: basestring 2247 @raise TypeError: incorrect type for input value 2248 ''' 2231 2249 if not isinstance(value, basestring): 2232 2250 raise TypeError("\"value\" must be a basestring derived type, " … … 2239 2257 2240 2258 class StatusCode(SAMLObject): 2241 '''Implementation of SAML 2.0 StatusCode.''' 2259 '''Implementation of SAML 2.0 StatusCode. 2260 2261 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Local Name of StatusCode. 2262 @type DEFAULT_ELEMENT_LOCAL_NAME: string 2263 @cvar DEFAULT_ELEMENT_NAME: Default element name. 2264 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 2265 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 2266 @type TYPE_LOCAL_NAME: string 2267 @cvar TYPE_NAME: QName of the XSI type. 2268 @type TYPE_NAME: ndg.saml.common.xml.QName 2269 @cvar VALUE_ATTRIB_NAME: Local Name of the Value attribute. 2270 @type VALUE_ATTRIB_NAME: string 2271 @cvar SUCCESS_URI: URI for Success status code. 2272 @type SUCCESS_URI: string 2273 @cvar REQUESTER_URI: URI for Requester status code. 2274 @type REQUESTER_URI: string 2275 @cvar RESPONDER_URI: URI for Responder status code. 2276 @type RESPONDER_URI: string 2277 @cvar VERSION_MISMATCH_URI: URI for VersionMismatch status code. 2278 @type VERSION_MISMATCH_URI: string 2279 @cvar AUTHN_FAILED_URI: URI for AuthnFailed status code. 2280 @type AUTHN_FAILED_URI: string 2281 @cvar INVALID_ATTR_NAME_VALUE_URI: URI for InvalidAttrNameOrValue status code. 2282 @type INVALID_ATTR_NAME_VALUE_URI: string 2283 @cvar INVALID_NAMEID_POLICY_URI: URI for InvalidNameIDPolicy status code. 2284 @type INVALID_NAMEID_POLICY_URI: string 2285 @cvar NO_AUTHN_CONTEXT_URI: URI for NoAuthnContext status code. 2286 @type NO_AUTHN_CONTEXT_URI: string 2287 @cvar NO_AVAILABLE_IDP_URI: URI for NoAvailableIDP status code. 2288 @type NO_AVAILABLE_IDP_URI: string 2289 @cvar NO_PASSIVE_URI: URI for NoPassive status code. 2290 @type NO_PASSIVE_URI: string 2291 @cvar NO_SUPPORTED_IDP_URI: URI for NoSupportedIDP status code. 2292 @type NO_SUPPORTED_IDP_URI: string 2293 @cvar PARTIAL_LOGOUT_URI: URI for PartialLogout status code. 2294 @type PARTIAL_LOGOUT_URI: string 2295 @cvar PROXY_COUNT_EXCEEDED_URI: URI for ProxyCountExceeded status code. 2296 @type PROXY_COUNT_EXCEEDED_URI: string 2297 @cvar REQUEST_DENIED_URI: URI for RequestDenied status code. 2298 @type REQUEST_DENIED_URI: string 2299 @cvar REQUEST_UNSUPPORTED_URI: URI for RequestUnsupported status code. 2300 @type REQUEST_UNSUPPORTED_URI: string 2301 @cvar REQUEST_VERSION_DEPRECATED_URI: URI for RequestVersionDeprecated status code. 2302 @type REQUEST_VERSION_DEPRECATED_URI: string 2303 @cvar REQUEST_VERSION_TOO_HIGH_URI: URI for RequestVersionTooHigh status code. 2304 @type REQUEST_VERSION_TOO_HIGH_URI: string 2305 @cvar REQUEST_VERSION_TOO_LOW_URI: URI for RequestVersionTooLow status code. 2306 @type REQUEST_VERSION_TOO_LOW_URI: string 2307 @cvar RESOURCE_NOT_RECOGNIZED_URI: URI for ResourceNotRecognized status code. 2308 @type RESOURCE_NOT_RECOGNIZED_URI: string 2309 @cvar TOO_MANY_RESPONSES: URI for TooManyResponses status code. 2310 @type TOO_MANY_RESPONSES: string 2311 @cvar UNKNOWN_ATTR_PROFILE_URI: URI for UnknownAttrProfile status code. 2312 @type UNKNOWN_ATTR_PROFILE_URI: string 2313 @cvar UNKNOWN_PRINCIPAL_URI: URI for UnknownPrincipal status code. 2314 @type UNKNOWN_PRINCIPAL_URI: string 2315 @cvar UNSUPPORTED_BINDING_URI: URI for UnsupportedBinding status code. 2316 @type UNSUPPORTED_BINDING_URI: string 2317 2318 @ivar __value: status code value 2319 @type __value: 2320 @ivar __childStatusCode: child element status code value 2321 @type __childStatusCode: 2322 ''' 2242 2323 2243 2324 # Local Name of StatusCode. … … 2343 2424 2344 2425 def __init__(self, **kw): 2426 """ 2427 @param **kw: keywords to initialise superclass attributes 2428 @type **kw: dict 2429 """ 2345 2430 super(StatusCode, self).__init__(**kw) 2346 2431 … … 2370 2455 2371 2456 def _getStatusCode(self): 2457 """Get child status code 2458 @return: status code value 2459 @rtype: ndg.saml.saml2.core.StatusCode 2460 """ 2372 2461 return self.__childStatusCode 2373 2462 2374 2463 def _setStatusCode(self, value): 2464 """Set child status code 2465 @param __value: status code value 2466 @type __value: ndg.saml.saml2.core.StatusCode 2467 """ 2375 2468 if not isinstance(value, StatusCode): 2376 2469 raise TypeError('Child "statusCode" must be a %r derived type, ' … … 2384 2477 2385 2478 def _getValue(self): 2479 """Get status message 2480 @return: message text 2481 @rtype: basestring 2482 """ 2386 2483 return self.__value 2387 2484 2388 2485 def _setValue(self, value): 2486 """Set status message 2487 @param value: message text 2488 @type value: basestring 2489 """ 2389 2490 if not isinstance(value, basestring): 2390 2491 raise TypeError("\"value\" must be a basestring derived type, " … … 2397 2498 2398 2499 class Status(SAMLObject): 2399 '''SAML 2.0 Core Status''' 2500 '''SAML 2.0 Core Status 2501 2502 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Local Name of Status. 2503 @type DEFAULT_ELEMENT_LOCAL_NAME: string 2504 @cvar DEFAULT_ELEMENT_NAME: Default element name. 2505 @type DEFAULT_ELEMENT_NAME: ndg.common.xml.QName 2506 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 2507 @type TYPE_LOCAL_NAME: string 2508 @cvar TYPE_NAME: QName of the XSI type. 2509 @type TYPE_NAME: ndg.common.xml.QName 2510 2511 @ivar __statusCode: status code 2512 @type __statusCode: ndg.saml.saml2.core.StatusCode 2513 @ivar __statusMessage: status message 2514 @type __statusMessage: ndg.saml.saml2.core.StatusMessage 2515 @ivar __statusDetail: status detail 2516 @type __statusDetail: ndg.saml.saml2.core.StatusDetail 2517 ''' 2400 2518 2401 2519 # Local Name of Status. … … 2415 2533 SAMLConstants.SAML20P_PREFIX) 2416 2534 2417 __slots__ = ('__statusCode', '__statusMessage', '__statusDetail', ) 2535 __slots__ = ( 2536 '__statusCode', 2537 '__statusMessage', 2538 '__statusDetail', 2539 ) 2418 2540 2419 2541 def __init__(self, **kw): … … 2435 2557 @rtype: dict 2436 2558 ''' 2437 2438 2559 _dict = super(Status, self).__getstate__() 2439 2560 for attrName in Status.__slots__: … … 2448 2569 2449 2570 def _getStatusCode(self): 2450 ''' 2451 Gets the Code of this Status.2452 2453 @r eturn: StatusStatusCode2571 '''Get the Code of this Status 2572 2573 @return: Status object's StatusCode 2574 @rtype: ndg.saml.saml2.core.StatusCode 2454 2575 ''' 2455 2576 return self.__statusCode 2456 2577 2457 2578 def _setStatusCode(self, value): 2458 ''' 2459 Sets the Code of this Status. 2460 2461 @param value: the Code of this Status 2579 '''Set the Code of this Status 2580 2581 @param value: the Code of this Status object 2582 @type value: ndg.saml.saml2.core.StatusCode 2583 @raise TypeError: incorrect type for input code value 2462 2584 ''' 2463 2585 if not isinstance(value, StatusCode): … … 2472 2594 2473 2595 def _getStatusMessage(self): 2474 ''' 2475 Gets the Message of this Status.2476 2477 @r eturn: StatusStatusMessage2596 '''Get the Message of this Status. 2597 2598 @return: Status message 2599 @rtype: ndg.saml.saml2.core.StatusMessage 2478 2600 ''' 2479 2601 return self.__statusMessage 2480 2602 2481 2603 def _setStatusMessage(self, value): 2482 ''' 2483 Sets the Message of this Status. 2484 2485 @param value: the Message of this Status 2604 '''Set the Message of this Status 2605 2606 @param value: the Message associated with this Status 2607 @type value: ndg.saml.saml2.core.StatusMessage 2608 @raise TypeError: incorrect input value type 2486 2609 ''' 2487 2610 if not isinstance(value, StatusMessage): … … 2496 2619 2497 2620 def _getStatusDetail(self): 2498 ''' 2499 Gets the Detail of this Status.2500 2501 @r eturn: StatusStatusDetail2621 '''Get the Detail of this Status 2622 2623 @return: Status object's StatusDetail 2624 @rtype: ndg.saml.saml2.core.StatusDetail 2502 2625 ''' 2503 2626 return self.__statusDetail … … 2508 2631 2509 2632 @param value: the Detail of this Status 2510 ''' 2633 @type value: ndg.saml.saml2.core.StatusDetail; 2634 @raise TypeError: incorrect input value type 2635 ''' 2636 if not isinstance(value, StatusDetail): 2637 raise TypeError('"statusDetail" must be a %r derived type, ' 2638 "got %r" % (StatusDetail, type(value))) 2511 2639 self.__statusDetail = value 2512 2640 2513 2641 statusDetail = property(fget=_getStatusDetail, 2514 2642 fset=_setStatusDetail, 2515 doc="status message")2643 doc="status detail") 2516 2644 2517 2645 2518 2646 class Action(SAMLObject): 2519 '''SAML 2.0 Core Action''' 2647 '''SAML 2.0 Core Action 2648 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Element local name. 2649 @type DEFAULT_ELEMENT_LOCAL_NAME: string 2650 @cvar DEFAULT_ELEMENT_NAME: Default element name. 2651 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 2652 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 2653 @type TYPE_LOCAL_NAME: string 2654 @cvar TYPE_NAME: QName of the XSI type 2655 @type TYPE_NAME: ndg.saml.common.xml.QName 2656 @cvar NAMESPACE_ATTRIB_NAME: Name of the Namespace attribute. 2657 @type NAMESPACE_ATTRIB_NAME: string 2658 @cvar RWEDC_NS_URI: Read/Write/Execute/Delete/Control action namespace. 2659 @type RWEDC_NS_URI: string 2660 @cvar RWEDC_NEGATION_NS_URI: Read/Write/Execute/Delete/Control negation 2661 action namespace. 2662 @type RWEDC_NEGATION_NS_URI: string 2663 @cvar GHPP_NS_URI: Get/Head/Put/Post action namespace. 2664 @type GHPP_NS_URI: string 2665 @cvar UNIX_NS_URI: UNIX file permission action namespace. 2666 @type UNIX_NS_URI: string 2667 @cvar ACTION_NS_IDENTIFIERS: Action namespace identifiers 2668 @type ACTION_NS_IDENTIFIERS: tuple 2669 @cvar READ_ACTION: Read action. 2670 @type READ_ACTION: string 2671 @cvar WRITE_ACTION: Write action. 2672 @type WRITE_ACTION: string 2673 @cvar EXECUTE_ACTION: Execute action. 2674 @type EXECUTE_ACTION: string 2675 @cvar DELETE_ACTION: Delete action. 2676 @type DELETE_ACTION: string 2677 @cvar CONTROL_ACTION: Control action. 2678 @type CONTROL_ACTION: string 2679 @cvar NEG_READ_ACTION: Negated Read action. 2680 @type NEG_READ_ACTION: string 2681 @cvar NEG_WRITE_ACTION: Negated Write action. 2682 @type NEG_WRITE_ACTION: string 2683 @cvar NEG_EXECUTE_ACTION: Negated Execute action. 2684 @type NEG_EXECUTE_ACTION: string 2685 @cvar NEG_DELETE_ACTION: Negated Delete action. 2686 @type NEG_DELETE_ACTION: string 2687 @cvar NEG_CONTROL_ACTION: Negated Control action. 2688 @type NEG_CONTROL_ACTION: string 2689 @cvar HTTP_GET_ACTION: HTTP GET action. 2690 @type HTTP_GET_ACTION: string 2691 @cvar HTTP_HEAD_ACTION: HTTP HEAD action. 2692 @type HTTP_HEAD_ACTION: string 2693 @cvar HTTP_PUT_ACTION: HTTP PUT action. 2694 @type HTTP_PUT_ACTION: string 2695 @cvar HTTP_POST_ACTION: HTTP POST action. 2696 @type HTTP_POST_ACTION: string 2697 @cvar ACTION_TYPES: Recognised action URI to action types mapping 2698 @type ACTION_TYPES: dict 2699 2700 @ivar __namespace: action namespace 2701 @type __namespace: string 2702 @ivar __value: action type value 2703 @type __value: string 2704 @ivar __actionTypes: valid action types for each of a given set of action 2705 namespaces 2706 @type __actionTypes: dict 2707 ''' 2520 2708 2521 2709 # Element local name. … … 2550 2738 UNIX_NS_URI = "urn:oasis:names:tc:SAML:1.0:action:unix" 2551 2739 2740 # Action namespace identifiers 2552 2741 ACTION_NS_IDENTIFIERS = ( 2553 2742 RWEDC_NS_URI, … … 2599 2788 HTTP_POST_ACTION = "POST" 2600 2789 2790 # Recognised action URI to action types mapping 2601 2791 ACTION_TYPES = { 2602 2792 RWEDC_NS_URI: (READ_ACTION, WRITE_ACTION, EXECUTE_ACTION, DELETE_ACTION, … … 2613 2803 } 2614 2804 2615 __slots__ = ('__namespace', '__value', '__actionTypes') 2805 __slots__ = ( 2806 '__namespace', 2807 '__value', 2808 '__actionTypes' 2809 ) 2616 2810 2617 2811 def __init__(self, **kw): … … 2635 2829 @rtype: dict 2636 2830 ''' 2637 2638 2831 _dict = super(Action, self).__getstate__() 2639 2832 for attrName in Action.__slots__: … … 2648 2841 2649 2842 def _getActionTypes(self): 2843 """Get action namespace to action types map 2844 @return: action types map 2845 @rtype: dict 2846 """ 2650 2847 return self.__actionTypes 2651 2848 2652 2849 def _setActionTypes(self, value): 2850 """Set action namespace to action types map 2851 @param value: action types map 2852 @type value: dict 2853 @raise TypeError: incorrect type for input value 2854 """ 2653 2855 if not isinstance(value, dict): 2654 2856 raise TypeError('Expecting list or tuple type for "actionTypes" ' … … 2667 2869 2668 2870 def _getNamespace(self): 2669 ''' 2670 gets the namespace scope of the specified value.2671 2672 @r eturn: the namespace scope of the specified value2871 '''Get the namespace of the action 2872 2873 @return: the namespace of the action 2874 @rtype: basestring 2673 2875 ''' 2674 2876 return self.__namespace 2675 2877 2676 2878 def _setNamespace(self, value): 2677 '''Sets the namespace scope of the specified value. 2678 2679 @param value: the namespace scope of the specified value 2879 '''Set the namespace of the action 2880 2881 @param value: the namespace of the action 2882 @type value: basestring 2680 2883 ''' 2681 2884 if not isinstance(value, basestring): … … 2693 2896 2694 2897 def _getValue(self): 2695 ''' getsthe URI of the action to be performed.2898 '''Get the URI of the action to be performed. 2696 2899 2697 2900 @return: the URI of the action to be performed 2901 @rtype: basestring or int 2698 2902 ''' 2699 2903 return self.__value 2700 2904 2701 2905 def _setValue(self, value): 2702 '''Set sthe URI of the action to be performed.2906 '''Set the URI of the action to be performed. 2703 2907 2704 2908 @param value: the URI of the value to be performed 2909 @type value: basestring or int 2910 @raise TypeError: incorrect type for input value 2705 2911 ''' 2706 2912 # int and oct allow for UNIX file permissions action type … … 2732 2938 2733 2939 class RequestAbstractType(SAMLObject): 2734 '''SAML 2.0 Core RequestAbstractType''' 2940 '''SAML 2.0 Core RequestAbstractType 2941 2942 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 2943 @type TYPE_LOCAL_NAME: string 2944 @cvar TYPE_NAME: QName of the XSI type. 2945 @type TYPE_NAME: ndg.saml.common.xml.QName 2946 @cvar ID_ATTRIB_NAME: ID attribute name. 2947 @type ID_ATTRIB_NAME: string 2948 @cvar VERSION_ATTRIB_NAME: Version attribute name. 2949 @type VERSION_ATTRIB_NAME: string 2950 @cvar ISSUE_INSTANT_ATTRIB_NAME: IssueInstant attribute name. 2951 @type ISSUE_INSTANT_ATTRIB_NAME: string 2952 @cvar DESTINATION_ATTRIB_NAME: Destination attribute name. 2953 @type DESTINATION_ATTRIB_NAME: string 2954 @cvar CONSENT_ATTRIB_NAME: Consent attribute name. 2955 @type CONSENT_ATTRIB_NAME: string 2956 @cvar UNSPECIFIED_CONSENT: Unspecified consent URI. 2957 @type UNSPECIFIED_CONSENT: string 2958 @cvar OBTAINED_CONSENT: Obtained consent URI. 2959 @type OBTAINED_CONSENT: string 2960 @cvar PRIOR_CONSENT: Prior consent URI. 2961 @type PRIOR_CONSENT: string 2962 @cvar IMPLICIT_CONSENT: Implicit consent URI. 2963 @type IMPLICIT_CONSENT: string 2964 @cvar EXPLICIT_CONSENT: Explicit consent URI. 2965 @type EXPLICIT_CONSENT: string 2966 @cvar UNAVAILABLE_CONSENT: Unavailable consent URI. 2967 @type UNAVAILABLE_CONSENT: string 2968 @cvar INAPPLICABLE_CONSENT: Inapplicable consent URI. 2969 @type INAPPLICABLE_CONSENT: string 2970 2971 @ivar __version: SAML version 2972 @type __version: string 2973 @ivar __id: request identifier 2974 @type __id: string 2975 @ivar __issueInstant: issue instant 2976 @type __issueInstant: string 2977 @ivar __destination: destination for request 2978 @type __destination: string 2979 @ivar __consent: consent information 2980 @type __consent: string 2981 @ivar __issuer: request issuer identifier 2982 @type __issuer: string 2983 @ivar __extensions: request extensions 2984 @type __extensions: string 2985 ''' 2735 2986 2736 2987 # Local name of the XSI type. … … 2835 3086 2836 3087 def _get_version(self): 2837 '''@return: the SAML Version of this assertion. 3088 ''' 3089 @return: the SAML Version of this assertion 3090 @rtype: ndg.saml.common.SAMLVersion 2838 3091 ''' 2839 3092 return self.__version 2840 3093 2841 3094 def _set_version(self, version): 2842 '''@param version: the SAML Version of this assertion 3095 ''' 3096 @param version: the SAML Version of this assertion 3097 @type version: ndg.saml.common.SAMLVersion 3098 @raise TypeError: incorrect input version value type 2843 3099 ''' 2844 3100 if not isinstance(version, SAMLVersion): … … 2853 3109 2854 3110 def _get_issueInstant(self): 2855 '''Gets the date/time the request was issued 2856 2857 @return: the issue instance of this request''' 3111 '''Get the date/time the request was issued 3112 3113 @return: the issue instance of this request 3114 @rtype: datetime.datetime 3115 ''' 2858 3116 return self.__issueInstant 2859 3117 … … 2862 3120 2863 3121 @param value: the issue instance of this request 3122 @type value: datetime.datetime 2864 3123 ''' 2865 3124 if not isinstance(value, datetime): … … 2874 3133 2875 3134 def _get_id(self): 2876 ''' Sets the unique identifier for this request.3135 '''Get the unique identifier for this request 2877 3136 2878 3137 @return: the ID of this request 3138 @rtype: basestring 2879 3139 ''' 2880 3140 return self.__id 2881 3141 2882 3142 def _set_id(self, value): 2883 '''Set sthe unique identifier for this request3143 '''Set the unique identifier for this request 2884 3144 2885 3145 @param value: the ID of this assertion 3146 @type value: basestring 3147 @raise TypeError: incorrect input type 2886 3148 ''' 2887 3149 if not isinstance(value, basestring): … … 2893 3155 2894 3156 def _get_destination(self): 2895 '''Get s the URI of the destination of the request.3157 '''Get the URI of the destination of the request 2896 3158 2897 3159 @return: the URI of the destination of the request 3160 @rtype: basestring 2898 3161 ''' 2899 3162 return self.__destination 2900 3163 2901 3164 def _set_destination(self, value): 2902 '''Sets the URI of the destination of the request. 2903 2904 @param value: the URI of the destination of the request''' 3165 '''Set the URI of the destination of the request 3166 3167 @param value: the URI of the destination of the request 3168 @type value: basestring 3169 @raise TypeError: incorrect input value type 3170 ''' 2905 3171 if not isinstance(value, basestring): 2906 3172 raise TypeError('Expecting basestring derived type for ' … … 2913 3179 2914 3180 def _get_consent(self): 2915 '''Get sthe consent obtained from the principal for sending this2916 request .3181 '''Get the consent obtained from the principal for sending this 3182 request 2917 3183 2918 3184 @return: the consent obtained from the principal for sending this 2919 3185 request 3186 @rtype: basestring 2920 3187 ''' 2921 3188 return self.__consent 2922 3189 2923 3190 def _set_consent(self, value): 2924 '''Set sthe consent obtained from the principal for sending this2925 request .3191 '''Set the consent obtained from the principal for sending this 3192 request 2926 3193 2927 3194 @param value: the new consent obtained from the principal for 2928 3195 sending this request 3196 @type value: basestring 3197 @raise TypeError: incorrect input type 2929 3198 ''' 2930 3199 if not isinstance(value, basestring): … … 2938 3207 2939 3208 def _set_issuer(self, issuer): 2940 """Set issuer of request""" 3209 """Set issuer of request 3210 3211 @param issuer: issuer of the request 3212 @type issuer: ndg.saml.saml2.coreIssuer 3213 @raise TypeError: incorrect input type 3214 """ 2941 3215 if not isinstance(issuer, Issuer): 2942 3216 raise TypeError('"issuer" must be a %r, got %r' % (Issuer, … … 2946 3220 2947 3221 def _get_issuer(self): 2948 """Get the issuer name """ 3222 """Get the issuer name 3223 3224 @return: issuer of the request 3225 @rtype: ndg.saml.saml2.coreIssuer 3226 """ 2949 3227 return self.__issuer 2950 3228 … … 2954 3232 2955 3233 def _get_extensions(self): 2956 '''Get s the Extensions of this request.3234 '''Get the Extensions of this request 2957 3235 2958 3236 @return: the Status of this request 3237 @rtype: iterable 2959 3238 ''' 2960 3239 return self.__extensions … … 2964 3243 2965 3244 @param value: the Extensions of this request 3245 @type value: iterable 2966 3246 ''' 2967 3247 self.__extensions = value … … 2973 3253 2974 3254 class SubjectQuery(RequestAbstractType): 2975 """SAML 2.0 Core Subject Query type""" 3255 """SAML 2.0 Core Subject Query type 3256 3257 @cvar DEFAULT_ELEMENT_LOCAL_NAME: XML element name for Subject Query 3258 @type DEFAULT_ELEMENT_LOCAL_NAME: string 3259 3260 @ivar __subject: subject for this query 3261 @type __subject: ndg.saml.saml2.core.Subject 3262 """ 2976 3263 2977 3264 DEFAULT_ELEMENT_LOCAL_NAME = 'SubjectQuery' … … 2979 3266 __slots__ = ('__subject', ) 2980 3267 2981 def __init__(self): 2982 super(SubjectQuery, self).__init__() 3268 def __init__(self, **kw): 3269 '''Subject Query initialisation 3270 @type kw: dict 3271 @param kw: keywords to set attributes of superclasses 3272 ''' 3273 super(SubjectQuery, self).__init__(**kw) 2983 3274 self.__subject = None 2984 3275 … … 3004 3295 '''Gets the Subject of this request. 3005 3296 3006 @return: the Subject of this request''' 3297 @return: the Subject of this request 3298 @rtype: ndg.saml.saml2.core.Subject 3299 ''' 3007 3300 return self.__subject 3008 3301 … … 3010 3303 '''Sets the Subject of this request. 3011 3304 3012 @param value: the Subject of this request''' 3305 @param value: the Subject of this request 3306 @type value: ndg.saml.saml2.core.Subject 3307 @raise TypeError: incorrect input type 3308 ''' 3013 3309 if not isinstance(value, Subject): 3014 3310 raise TypeError('Setting "subject", got %r, expecting %r' % … … 3021 3317 3022 3318 class AttributeQuery(SubjectQuery): 3023 '''SAML 2.0 AttributeQuery''' 3319 '''SAML 2.0 AttributeQuery 3320 3321 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Element local name. 3322 @type DEFAULT_ELEMENT_LOCAL_NAME: string 3323 @cvar DEFAULT_ELEMENT_NAME: Default element name. 3324 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 3325 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 3326 @type TYPE_LOCAL_NAME: string 3327 @cvar TYPE_NAME: QName of the XSI type. 3328 @type TYPE_NAME: ndg.saml.common.xml.QName 3329 3330 @ivar __attributes: list of attributes for this query 3331 @type __attributes: TypedList 3332 ''' 3024 3333 3025 3334 # Element local name. … … 3041 3350 __slots__ = ('__attributes',) 3042 3351 3043 def __init__(self): 3044 super(AttributeQuery, self).__init__() 3352 def __init__(self, **kw): 3353 '''Attribute Query initialisation 3354 @type kw: dict 3355 @param kw: keywords to set attributes of superclasses 3356 ''' 3357 super(AttributeQuery, self).__init__(**kw) 3045 3358 self.__attributes = TypedList(Attribute) 3046 3359 … … 3064 3377 3065 3378 def _getAttributes(self): 3066 '''Gets the Attributes of this query. 3067 3068 @return: the list of Attributes of this query''' 3379 '''Get the Attributes of this query 3380 3381 @return: the list of Attributes of this query 3382 @rtype: ndg.saml.utils.TypedList''' 3069 3383 return self.__attributes 3070 3384 3071 3385 def _setAttributes(self, value): 3386 '''Set the attributes for this query 3387 3388 @param value: new attributes for this query 3389 @type value: TypedList 3390 @raise TypeError: incorrect type for attributes list 3391 ''' 3392 if not isinstance(value, TypedList): 3393 raise TypeError('Expecting %r type for "attributes"; got %r' % 3394 (TypedList, (type))) 3395 3396 if not issubclass(value.elementType, Attribute): 3397 raise TypeError('Expecting %r derived type for "attributes" ' 3398 'elements; got %r' % (Attribute, value.elementType)) 3399 3072 3400 self.__attributes = value 3073 3401 … … 3083 3411 3084 3412 class AssertionURIRef(Evidentiary): 3085 '''SAML 2.0 Core AssertionURIRef''' 3413 '''SAML 2.0 Core AssertionURIRef 3414 3415 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Element local name 3416 @type DEFAULT_ELEMENT_LOCAL_NAME: string 3417 @cvar DEFAULT_ELEMENT_NAME: Default element name 3418 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 3419 3420 @ivar __assertionURI: URI for this assertion reference 3421 @type __assertionURI: basestring 3422 ''' 3086 3423 __slots__ = ('__assertionURI',) 3087 3424 … … 3094 3431 SAMLConstants.SAML20_PREFIX) 3095 3432 3096 def __init__(self): 3097 '''Create assertion URI reference''' 3098 super(AssertionURIRef, self).__init__() 3433 def __init__(self, **kw): 3434 '''Create assertion URI reference 3435 3436 @param **kw: keywords to initialise superclasses 3437 @type **kw: dict 3438 ''' 3439 super(AssertionURIRef, self).__init__(**kw) 3099 3440 3100 3441 # URI of the Assertion … … 3107 3448 @rtype: dict 3108 3449 ''' 3109 3110 3450 _dict = super(AssertionURIRef, self).__getstate__() 3111 3451 for attrName in AssertionURIRef.__slots__: … … 3120 3460 3121 3461 def _getAssertionURI(self): 3462 '''Get assertion URI 3463 3464 @return assertionURI: assertion URI 3465 @rtype assertionURI: basestring 3466 ''' 3122 3467 return self.__assertionURI 3123 3468 3124 3469 def _setAssertionURI(self, value): 3470 '''Set assertion URI 3471 3472 @param assertionURI: assertion URI 3473 @type assertionURI: basestring 3474 @raise TypeError: incorrect input value type 3475 ''' 3125 3476 if not isinstance(value, basestring): 3126 3477 raise TypeError('Expecting string type for "assertionID" ' … … 3129 3480 3130 3481 def getOrderedChildren(self): 3131 return None 3482 """Return list of all attributes - not implemented for this class 3483 """ 3132 3484 3133 3485 assertionURI = property(_getAssertionURI, _setAssertionURI, … … 3136 3488 3137 3489 class AssertionIDRef(Evidentiary): 3138 '''SAML 2.0 Core AssertionIDRef.''' 3490 '''SAML 2.0 Core AssertionIDRef. 3491 3492 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Element local name. 3493 @type DEFAULT_ELEMENT_LOCAL_NAME: string 3494 @cvar DEFAULT_ELEMENT_NAME: Default element name. 3495 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 3496 3497 @ivar __assertionID: assertion identifier 3498 @type __assertionID: basestring 3499 ''' 3139 3500 3140 3501 # Element local name. … … 3146 3507 SAMLConstants.SAML20_PREFIX) 3147 3508 3148 __slots__ = ("_AssertionID",) 3149 3150 def __init__(self, namespaceURI, elementLocalName, namespacePrefix): 3151 ''' 3152 @param namespaceURI: the namespace the element is in 3153 @param elementLocalName: the local name of the XML element this Object 3154 represents 3155 @param namespacePrefix: the prefix for the given namespace 3156 ''' 3157 super(AssertionIDRef, self).__init__(namespaceURI, 3158 elementLocalName, 3159 namespacePrefix) 3509 __slots__ = ("__assertionID",) 3510 3511 def __init__(self, **kw): 3512 ''' 3513 @param **kw: keywords for superclass initialisation 3514 @type **kw: dict 3515 ''' 3516 super(AssertionIDRef, self).__init__(**kw) 3160 3517 self.__assertionID = None 3161 3518 … … 3179 3536 3180 3537 def _getAssertionID(self): 3181 '''Gets the ID of the assertion this references. 3182 3183 @return: the ID of the assertion this references''' 3538 '''Get the ID of the assertion this references 3539 3540 @return: the ID of the assertion this references 3541 @rtype: basestring 3542 ''' 3184 3543 return self.__assertionID 3185 3544 … … 3187 3546 '''Sets the ID of the assertion this references. 3188 3547 3189 @param value: the ID of the assertion this references''' 3548 @param value: the ID of the assertion this references 3549 @type value: basestring 3550 @raise TypeError: incorrect type for input value 3551 ''' 3190 3552 if not isinstance(value, basestring): 3191 3553 raise TypeError('Expecting string type for "assertionID" ' … … 3194 3556 3195 3557 def getOrderedChildren(self): 3196 return None 3558 '''Get attributes for this element as a list - not implemented for this 3559 class''' 3197 3560 3198 3561 assertionID = property(_getAssertionID, _setAssertionID, … … 3201 3564 3202 3565 class EncryptedElementType(SAMLObject): 3203 '''SAML 2.0 Core EncryptedElementType''' 3566 '''SAML 2.0 Core EncryptedElementType 3567 3568 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 3569 @type TYPE_LOCAL_NAME: string 3570 @cvar TYPE_NAME: QName of the XSI type. 3571 @type TYPE_NAME: string 3572 3573 ''' 3204 3574 3205 3575 # Local name of the XSI type. … … 3214 3584 3215 3585 def _getEncryptedData(self): 3216 '''Get the EncryptedData child element. 3217 3218 @return the EncryptedData child element'''3586 '''Get the EncryptedData child element. Not currently implemented 3587 3588 @return: the EncryptedData child element''' 3219 3589 raise NotImplementedError() 3220 3590 3221 3591 def _setEncryptedData(self, value): 3222 '''Set the EncryptedData child element. 3223 3224 @param newEncryptedDatathe new EncryptedData child element'''3592 '''Set the EncryptedData child element. Not currently implemented 3593 3594 @param value: the new EncryptedData child element''' 3225 3595 raise NotImplementedError() 3226 3596 3227 3597 def _getEncryptedKeys(self): 3228 '''A list of EncryptedKey child elements. 3229 3230 @return a list of EncryptedKey child elements'''3598 '''A list of EncryptedKey child elements. Not currently implemented 3599 3600 @return: a list of EncryptedKey child elements''' 3231 3601 raise NotImplementedError() 3232 3602 3233 3603 3234 3604 class EncryptedAssertion(EncryptedElementType, Evidentiary): 3235 '''SAML 2.0 Core EncryptedAssertion.''' 3605 '''SAML 2.0 Core EncryptedAssertion 3606 3607 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Element local name. 3608 @type DEFAULT_ELEMENT_LOCAL_NAME: string 3609 @cvar DEFAULT_ELEMENT_NAME: Default element name. 3610 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 3611 ''' 3236 3612 3237 3613 # Element local name. … … 3246 3622 3247 3623 class Evidence(SAMLObject): 3248 '''SAML 2.0 Core Evidence.''' 3624 '''SAML 2.0 Core Evidence 3625 3626 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Element local name. 3627 @type DEFAULT_ELEMENT_LOCAL_NAME: string 3628 @cvar DEFAULT_ELEMENT_NAME: Default element name. 3629 @type DEFAULT_ELEMENT_NAME: ndg.saml.common.xml.QName 3630 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 3631 @type TYPE_LOCAL_NAME: string 3632 @cvar TYPE_NAME: QName of the XSI type. 3633 @type TYPE_NAME: ndg.saml.common.xml.QName 3634 3635 @ivar __values: list of evidence values 3636 @type __values: ndg.saml.utils.TypedList 3637 ''' 3249 3638 3250 3639 # Element local name. … … 3268 3657 def __init__(self, **kw): 3269 3658 '''Create an authorization evidence type 3659 3660 @param **kw: keyword to initialise superclasses 3661 @type **kw: dict 3270 3662 ''' 3271 3663 super(Evidence, self).__init__(**kw) … … 3294 3686 @property 3295 3687 def assertionIDReferences(self): 3296 '''Gets the list of AssertionID references used as evidence. 3297 3298 @return: the list of AssertionID references used as evidence''' 3688 '''Get the list of Assertion ID references used as evidence 3689 3690 @return: the list of AssertionID references used as evidence 3691 @rtype: list 3692 ''' 3299 3693 return [i for i in self.__values 3300 3694 if (getattr(i, "DEFAULT_ELEMENT_NAME") == … … 3303 3697 @property 3304 3698 def assertionURIReferences(self): 3305 '''Get s the list of AssertionURI references used as evidence.3699 '''Get the list of Assertion URI references used as evidence 3306 3700 3307 @return: the list of AssertionURI references used as evidence''' 3701 @return: the list of AssertionURI references used as evidence 3702 @rtype: list''' 3308 3703 return [i for i in self.__values 3309 3704 if (getattr(i, "DEFAULT_ELEMENT_NAME") == … … 3312 3707 @property 3313 3708 def assertions(self): 3314 '''Get s the list of Assertions used as evidence.3709 '''Get the list of Assertions used as evidence 3315 3710 3316 @return: the list of Assertions used as evidence''' 3711 @return: the list of Assertions used as evidence 3712 @rtype: list 3713 ''' 3317 3714 return [i for i in self.__values 3318 3715 if (getattr(i, "DEFAULT_ELEMENT_NAME") == … … 3323 3720 '''Gets the list of EncryptedAssertions used as evidence. 3324 3721 3325 @return: the list of EncryptedAssertions used as evidence''' 3722 @return: the list of EncryptedAssertions used as evidence 3723 @rtype: list 3724 ''' 3326 3725 return [i for i in self.__values 3327 3726 if (getattr(i, "DEFAULT_ELEMENT_NAME") == … … 3330 3729 @property 3331 3730 def values(self): 3332 '''Get sthe list of all elements used as evidence.3731 '''Get the list of all elements used as evidence. 3333 3732 3334 @return: the list of Evidentiary objects used as evidence''' 3733 @return: the list of Evidentiary objects used as evidence 3734 @rtype: ndg.saml.utils.TypedList 3735 ''' 3335 3736 return self.__values 3336 3737 3337 3738 def getOrderedChildren(self): 3739 '''Return list of evidence objects 3740 ''' 3338 3741 children = [] 3339 3742 … … 3347 3750 3348 3751 class AuthzDecisionQuery(SubjectQuery): 3349 '''SAML 2.0 AuthzDecisionQuery.''' 3752 '''SAML 2.0 AuthzDecisionQuery 3753 3754 @cvar DEFAULT_ELEMENT_LOCAL_NAME: Element local name. 3755 @type DEFAULT_ELEMENT_LOCAL_NAME: string 3756 @cvar DEFAULT_ELEMENT_NAME: Default element name. 3757 @type DEFAULT_ELEMENT_NAME: string 3758 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 3759 @type TYPE_LOCAL_NAME: string 3760 @cvar TYPE_NAME: QName of the XSI type. 3761 @type TYPE_NAME: string 3762 @cvar RESOURCE_ATTRIB_NAME: Resource attribute name. 3763 @type RESOURCE_ATTRIB_NAME: string 3764 3765 @ivar resource: Resource attribute value. 3766 @type resource: string 3767 @ivar evidence: Evidence child element. 3768 @type evidence: string 3769 @ivar actions: Action child elements. 3770 @type actions: string 3771 @ivar normalizeResource: Set to Truefor normalization of resource URIs in 3772 property set method 3773 @type normalizeResource: bool 3774 @ivar safeNormalizationChars: safe character settings for normalisation 3775 @type safeNormalizationChars: string 3776 ''' 3350 3777 3351 3778 # Element local name. … … 3413 3840 3414 3841 def _getNormalizeResource(self): 3842 ''' 3843 @return: flag to set whether to apply normalisation of resource URI or 3844 not 3845 @rtype: bool 3846 ''' 3415 3847 return self.__normalizeResource 3416 3848 3417 3849 def _setNormalizeResource(self, value): 3850 ''' 3851 @param value: flag to set whether to apply normalisation of resource URI 3852 or not 3853 @type value: bool 3854 @raise TypeError: incorrect type for input value 3855 ''' 3418 3856 if not isinstance(value, bool): 3419 3857 raise TypeError('Expecting bool type for "normalizeResource" ' … … 3430 3868 3431 3869 def _getSafeNormalizationChars(self): 3870 ''' 3871 @param value: safe normalisation characters for input into normalisation 3872 of resource URI. 3873 @type value: string 3874 @raise TypeError: incorrect type for input value 3875 ''' 3432 3876 return self.__safeNormalizationChars 3433 3877 3434 3878 def _setSafeNormalizationChars(self, value): 3879 ''' 3880 @param value: safe normalisation characters for input into normalisation 3881 of resource URI. It only applies if normalizeResource is set to True 3882 @type value: string 3883 @raise TypeError: incorrect type for input value 3884 ''' 3435 3885 if not isinstance(value, basestring): 3436 3886 raise TypeError('Expecting string type for "normalizeResource" ' … … 3450 3900 3451 3901 def _getResource(self): 3452 '''Gets the Resource attrib value of this query. 3453 3454 @return: the Resource attrib value of this query''' 3902 '''Get the Resource attrib value of this query 3903 3904 @return: the Resource attrib value of this query 3905 @rtype: basestring 3906 ''' 3455 3907 return self.__resource 3456 3908 3457 3909 def _setResource(self, value): 3458 '''Sets the Resource attrib value of this query normalizing the path 3459 component, removing spurious port numbers (80 for HTTP and 443 for 3460 HTTPS) and converting the host component to lower case. 3461 3462 @param value: the new Resource attrib value of this query''' 3910 '''Sets the Resource attrib value of this query. 3911 3912 If normalizeResource attribute is True, the path is normalized 3913 removing spurious port numbers (80 for HTTP and 443 for HTTPS) and 3914 converting the host component to lower case. 3915 3916 @param value: the new Resource attrib value of this query 3917 @type value: basestring 3918 @raise TypeError: if incorrect input type 3919 ''' 3463 3920 if not isinstance(value, basestring): 3464 3921 raise TypeError('Expecting string type for "resource" attribute; ' … … 3499 3956 '''The actions for which authorisation is requested 3500 3957 3501 @return: the Actions of this query''' 3958 @return: the Actions of this query 3959 @rtype: ndg.saml.utils.TypedList 3960 ''' 3502 3961 return self.__actions 3503 3962 3504 3963 def _getEvidence(self): 3505 '''Gets the Evidence of this query. 3506 3507 @return: the Evidence of this query''' 3964 '''Get the Evidence of this query 3965 3966 @return: the Evidence of this query 3967 @rtype: ndg.saml.saml2.core.Evidence or NoneType 3968 ''' 3508 3969 return self.__evidence 3509 3970 3510 3971 def _setEvidence(self, value): 3511 '''Sets the Evidence of this query. 3512 @param newEvidence: the new Evidence of this query''' 3972 '''Set the Evidence of this query 3973 3974 @param value: the new Evidence of this query 3975 @type value: ndg.saml.saml2.core.Evidence 3976 @raise TypeError: incorrect input type 3977 ''' 3513 3978 if not isinstance(value, Evidence): 3514 3979 raise TypeError('Expecting Evidence type for "evidence" ' … … 3522 3987 3523 3988 def getOrderedChildren(self): 3989 '''Return attributes for this element as a tuple 3990 3991 @return: attributes for this element 3992 @rtype: tuple 3993 ''' 3524 3994 children = [] 3525 3995 … … 3541 4011 class StatusResponseType(SAMLObject): 3542 4012 '''SAML 2.0 Core Status Response Type 4013 4014 @cvar TYPE_LOCAL_NAME: Local name of the XSI type. 4015 @type TYPE_LOCAL_NAME: string 4016 @cvar TYPE_NAME: QName of the XSI type. 4017 @type TYPE_NAME: string 4018 @cvar ID_ATTRIB_NAME: ID attribute name 4019 @type ID_ATTRIB_NAME: string 4020 @cvar IN_RESPONSE_TO_ATTRIB_NAME: InResponseTo attribute name 4021 @type IN_RESPONSE_TO_ATTRIB_NAME: string 4022 @cvar VERSION_ATTRIB_NAME: Version attribute name 4023 @type VERSION_ATTRIB_NAME: string 4024 @cvar ISSUE_INSTANT_ATTRIB_NAME: IssueInstant attribute name 4025 @type ISSUE_INSTANT_ATTRIB_NAME: string 4026 @cvar DESTINATION_ATTRIB_NAME: Destination attribute name 4027 @type DESTINATION_ATTRIB_NAME: string 4028 @cvar CONSENT_ATTRIB_NAME: Consent attribute name. 4029 @type CONSENT_ATTRIB_NAME: string 4030 @cvar UNSPECIFIED_CONSENT: Unspecified consent URI 4031 @type UNSPECIFIED_CONSENT: string 4032 @cvar OBTAINED_CONSENT: Obtained consent URI 4033 @type OBTAINED_CONSENT: string 4034 @cvar PRIOR_CONSENT: Prior consent URI 4035 @type PRIOR_CONSENT: string 4036 @cvar IMPLICIT_CONSENT: Implicit consent URI 4037 @type IMPLICIT_CONSENT: string 4038 @cvar EXPLICIT_CONSENT: Explicit consent URI 4039 @type EXPLICIT_CONSENT: string 4040 @cvar UNAVAILABLE_CONSENT: Unavailable consent URI 4041 @type UNAVAILABLE_CONSENT: string 4042 @cvar INAPPLICABLE_CONSENT: Inapplicable consent URI 4043 @type INAPPLICABLE_CONSENT: string 4044 3543 4045 ''' 3544 4046
Note: See TracChangeset
for help on using the changeset viewer.