@@ 1861-1924 (lines=64) @@ | ||
1858 | ||
1859 | class UserTokenPolicy(FrozenClass): |
|
1860 | ''' |
|
1861 | Describes a user token that can be used with a server. |
|
1862 | ||
1863 | :ivar PolicyId: |
|
1864 | :vartype PolicyId: String |
|
1865 | :ivar TokenType: |
|
1866 | :vartype TokenType: UserTokenType |
|
1867 | :ivar IssuedTokenType: |
|
1868 | :vartype IssuedTokenType: String |
|
1869 | :ivar IssuerEndpointUrl: |
|
1870 | :vartype IssuerEndpointUrl: String |
|
1871 | :ivar SecurityPolicyUri: |
|
1872 | :vartype SecurityPolicyUri: String |
|
1873 | ''' |
|
1874 | ||
1875 | ua_types = { |
|
1876 | 'PolicyId': 'String', |
|
1877 | 'TokenType': 'UserTokenType', |
|
1878 | 'IssuedTokenType': 'String', |
|
1879 | 'IssuerEndpointUrl': 'String', |
|
1880 | 'SecurityPolicyUri': 'String', |
|
1881 | } |
|
1882 | ||
1883 | def __init__(self, binary=None): |
|
1884 | if binary is not None: |
|
1885 | self._binary_init(binary) |
|
1886 | self._freeze = True |
|
1887 | return |
|
1888 | self.PolicyId = None |
|
1889 | self.TokenType = UserTokenType(0) |
|
1890 | self.IssuedTokenType = None |
|
1891 | self.IssuerEndpointUrl = None |
|
1892 | self.SecurityPolicyUri = None |
|
1893 | self._freeze = True |
|
1894 | ||
1895 | def to_binary(self): |
|
1896 | packet = [] |
|
1897 | packet.append(uabin.Primitives.String.pack(self.PolicyId)) |
|
1898 | packet.append(uabin.Primitives.UInt32.pack(self.TokenType.value)) |
|
1899 | packet.append(uabin.Primitives.String.pack(self.IssuedTokenType)) |
|
1900 | packet.append(uabin.Primitives.String.pack(self.IssuerEndpointUrl)) |
|
1901 | packet.append(uabin.Primitives.String.pack(self.SecurityPolicyUri)) |
|
1902 | return b''.join(packet) |
|
1903 | ||
1904 | @staticmethod |
|
1905 | def from_binary(data): |
|
1906 | return UserTokenPolicy(data) |
|
1907 | ||
1908 | def _binary_init(self, data): |
|
1909 | self.PolicyId = uabin.Primitives.String.unpack(data) |
|
1910 | self.TokenType = UserTokenType(uabin.Primitives.UInt32.unpack(data)) |
|
1911 | self.IssuedTokenType = uabin.Primitives.String.unpack(data) |
|
1912 | self.IssuerEndpointUrl = uabin.Primitives.String.unpack(data) |
|
1913 | self.SecurityPolicyUri = uabin.Primitives.String.unpack(data) |
|
1914 | ||
1915 | def __str__(self): |
|
1916 | return 'UserTokenPolicy(' + 'PolicyId:' + str(self.PolicyId) + ', ' + \ |
|
1917 | 'TokenType:' + str(self.TokenType) + ', ' + \ |
|
1918 | 'IssuedTokenType:' + str(self.IssuedTokenType) + ', ' + \ |
|
1919 | 'IssuerEndpointUrl:' + str(self.IssuerEndpointUrl) + ', ' + \ |
|
1920 | 'SecurityPolicyUri:' + str(self.SecurityPolicyUri) + ')' |
|
1921 | ||
1922 | __repr__ = __str__ |
|
1923 | ||
1924 | ||
1925 | class EndpointDescription(FrozenClass): |
|
1926 | ''' |
|
1927 | The description of a endpoint that can be used to access a server. |
|
@@ 2689-2750 (lines=62) @@ | ||
2686 | ||
2687 | class OpenSecureChannelParameters(FrozenClass): |
|
2688 | ''' |
|
2689 | :ivar ClientProtocolVersion: |
|
2690 | :vartype ClientProtocolVersion: UInt32 |
|
2691 | :ivar RequestType: |
|
2692 | :vartype RequestType: SecurityTokenRequestType |
|
2693 | :ivar SecurityMode: |
|
2694 | :vartype SecurityMode: MessageSecurityMode |
|
2695 | :ivar ClientNonce: |
|
2696 | :vartype ClientNonce: ByteString |
|
2697 | :ivar RequestedLifetime: |
|
2698 | :vartype RequestedLifetime: UInt32 |
|
2699 | ''' |
|
2700 | ||
2701 | ua_types = { |
|
2702 | 'ClientProtocolVersion': 'UInt32', |
|
2703 | 'RequestType': 'SecurityTokenRequestType', |
|
2704 | 'SecurityMode': 'MessageSecurityMode', |
|
2705 | 'ClientNonce': 'ByteString', |
|
2706 | 'RequestedLifetime': 'UInt32', |
|
2707 | } |
|
2708 | ||
2709 | def __init__(self, binary=None): |
|
2710 | if binary is not None: |
|
2711 | self._binary_init(binary) |
|
2712 | self._freeze = True |
|
2713 | return |
|
2714 | self.ClientProtocolVersion = 0 |
|
2715 | self.RequestType = SecurityTokenRequestType(0) |
|
2716 | self.SecurityMode = MessageSecurityMode(0) |
|
2717 | self.ClientNonce = None |
|
2718 | self.RequestedLifetime = 0 |
|
2719 | self._freeze = True |
|
2720 | ||
2721 | def to_binary(self): |
|
2722 | packet = [] |
|
2723 | packet.append(uabin.Primitives.UInt32.pack(self.ClientProtocolVersion)) |
|
2724 | packet.append(uabin.Primitives.UInt32.pack(self.RequestType.value)) |
|
2725 | packet.append(uabin.Primitives.UInt32.pack(self.SecurityMode.value)) |
|
2726 | packet.append(uabin.Primitives.ByteString.pack(self.ClientNonce)) |
|
2727 | packet.append(uabin.Primitives.UInt32.pack(self.RequestedLifetime)) |
|
2728 | return b''.join(packet) |
|
2729 | ||
2730 | @staticmethod |
|
2731 | def from_binary(data): |
|
2732 | return OpenSecureChannelParameters(data) |
|
2733 | ||
2734 | def _binary_init(self, data): |
|
2735 | self.ClientProtocolVersion = uabin.Primitives.UInt32.unpack(data) |
|
2736 | self.RequestType = SecurityTokenRequestType(uabin.Primitives.UInt32.unpack(data)) |
|
2737 | self.SecurityMode = MessageSecurityMode(uabin.Primitives.UInt32.unpack(data)) |
|
2738 | self.ClientNonce = uabin.Primitives.ByteString.unpack(data) |
|
2739 | self.RequestedLifetime = uabin.Primitives.UInt32.unpack(data) |
|
2740 | ||
2741 | def __str__(self): |
|
2742 | return 'OpenSecureChannelParameters(' + 'ClientProtocolVersion:' + str(self.ClientProtocolVersion) + ', ' + \ |
|
2743 | 'RequestType:' + str(self.RequestType) + ', ' + \ |
|
2744 | 'SecurityMode:' + str(self.SecurityMode) + ', ' + \ |
|
2745 | 'ClientNonce:' + str(self.ClientNonce) + ', ' + \ |
|
2746 | 'RequestedLifetime:' + str(self.RequestedLifetime) + ')' |
|
2747 | ||
2748 | __repr__ = __str__ |
|
2749 | ||
2750 | ||
2751 | class OpenSecureChannelRequest(FrozenClass): |
|
2752 | ''' |
|
2753 | Creates a secure channel with a server. |