| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Collections.Generic; |
| | | 6 | | using System.Collections.ObjectModel; |
| | | 7 | | using System.Runtime.Serialization; |
| | | 8 | | using System.Security.Cryptography; |
| | | 9 | | using System.Xml; |
| | | 10 | | using CoreWCF.IdentityModel.Policy; |
| | | 11 | | using CoreWCF.IdentityModel.Selectors; |
| | | 12 | | using CoreWCF.IdentityModel.Tokens; |
| | | 13 | | |
| | | 14 | | namespace CoreWCF.Security |
| | | 15 | | { |
| | | 16 | | internal abstract class TrustDriver |
| | | 17 | | { |
| | | 18 | | // issued tokens control |
| | 0 | 19 | | public virtual bool IsIssuedTokensSupported => false; |
| | | 20 | | |
| | | 21 | | // issued tokens feature |
| | | 22 | | public virtual string IssuedTokensHeaderName => |
| | 0 | 23 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.Tru |
| | | 24 | | |
| | | 25 | | // issued tokens feature |
| | | 26 | | public virtual string IssuedTokensHeaderNamespace => |
| | 0 | 27 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.Tru |
| | | 28 | | |
| | | 29 | | // session control |
| | 0 | 30 | | public virtual bool IsSessionSupported => false; |
| | | 31 | | |
| | | 32 | | public abstract XmlDictionaryString RequestSecurityTokenAction { get; } |
| | | 33 | | |
| | | 34 | | public abstract XmlDictionaryString RequestSecurityTokenResponseAction { get; } |
| | | 35 | | |
| | | 36 | | public abstract XmlDictionaryString RequestSecurityTokenResponseFinalAction { get; } |
| | | 37 | | |
| | | 38 | | // session feature |
| | | 39 | | public virtual string RequestTypeClose => |
| | 0 | 40 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.Tru |
| | | 41 | | |
| | | 42 | | public abstract string RequestTypeIssue { get; } |
| | | 43 | | |
| | | 44 | | // session feature |
| | | 45 | | public virtual string RequestTypeRenew => |
| | 0 | 46 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.Tru |
| | | 47 | | |
| | | 48 | | public abstract string ComputedKeyAlgorithm { get; } |
| | | 49 | | |
| | | 50 | | public abstract SecurityStandardsManager StandardsManager { get; } |
| | | 51 | | |
| | | 52 | | public abstract XmlDictionaryString Namespace { get; } |
| | | 53 | | |
| | | 54 | | // RST specific method |
| | | 55 | | public abstract RequestSecurityToken CreateRequestSecurityToken(XmlReader reader); |
| | | 56 | | |
| | | 57 | | // RSTR specific method |
| | | 58 | | public abstract RequestSecurityTokenResponse CreateRequestSecurityTokenResponse(XmlReader reader); |
| | | 59 | | |
| | | 60 | | // RSTRC specific method |
| | | 61 | | public abstract RequestSecurityTokenResponseCollection CreateRequestSecurityTokenResponseCollection(XmlReader xm |
| | | 62 | | |
| | | 63 | | public abstract bool IsAtRequestSecurityTokenResponse(XmlReader reader); |
| | | 64 | | |
| | | 65 | | public abstract bool IsAtRequestSecurityTokenResponseCollection(XmlReader reader); |
| | | 66 | | |
| | | 67 | | public abstract bool IsRequestedSecurityTokenElement(string name, string nameSpace); |
| | | 68 | | |
| | | 69 | | public abstract bool IsRequestedProofTokenElement(string name, string nameSpace); |
| | | 70 | | |
| | | 71 | | public abstract T GetAppliesTo<T>(RequestSecurityToken rst, XmlObjectSerializer serializer); |
| | | 72 | | |
| | | 73 | | public abstract T GetAppliesTo<T>(RequestSecurityTokenResponse rstr, XmlObjectSerializer serializer); |
| | | 74 | | |
| | | 75 | | public abstract void GetAppliesToQName(RequestSecurityToken rst, out string localName, out string namespaceUri); |
| | | 76 | | |
| | | 77 | | public abstract void GetAppliesToQName(RequestSecurityTokenResponse rstr, out string localName, out string names |
| | | 78 | | |
| | | 79 | | public abstract bool IsAppliesTo(string localName, string namespaceUri); |
| | | 80 | | |
| | | 81 | | // RSTR specific method |
| | | 82 | | public abstract byte[] GetAuthenticator(RequestSecurityTokenResponse rstr); |
| | | 83 | | |
| | | 84 | | // RST specific method |
| | | 85 | | public abstract BinaryNegotiation GetBinaryNegotiation(RequestSecurityToken rst); |
| | | 86 | | |
| | | 87 | | // RSTR specific method |
| | | 88 | | public abstract BinaryNegotiation GetBinaryNegotiation(RequestSecurityTokenResponse rstr); |
| | | 89 | | |
| | | 90 | | // RST specific method |
| | | 91 | | public abstract SecurityToken GetEntropy(RequestSecurityToken rst, SecurityTokenResolver resolver); |
| | | 92 | | |
| | | 93 | | // RSTR specific method |
| | | 94 | | public abstract SecurityToken GetEntropy(RequestSecurityTokenResponse rstr, SecurityTokenResolver resolver); |
| | | 95 | | |
| | | 96 | | // RSTR specific method |
| | | 97 | | public abstract GenericXmlSecurityToken GetIssuedToken(RequestSecurityTokenResponse rstr, SecurityTokenResolver |
| | | 98 | | string expectedTokenType, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies, int defaultKeySize |
| | | 99 | | |
| | | 100 | | public abstract GenericXmlSecurityToken GetIssuedToken(RequestSecurityTokenResponse rstr, string expectedTokenTy |
| | | 101 | | |
| | | 102 | | public abstract void OnRSTRorRSTRCMissingException(); |
| | | 103 | | |
| | | 104 | | // RST specific method |
| | | 105 | | public abstract void WriteRequestSecurityToken(RequestSecurityToken rst, XmlWriter w); |
| | | 106 | | |
| | | 107 | | // RSTR specific method |
| | | 108 | | public abstract void WriteRequestSecurityTokenResponse(RequestSecurityTokenResponse rstr, XmlWriter w); |
| | | 109 | | |
| | | 110 | | // RSTR Collection method |
| | | 111 | | public abstract void WriteRequestSecurityTokenResponseCollection(RequestSecurityTokenResponseCollection rstrColl |
| | | 112 | | |
| | | 113 | | // Federation proxy creation |
| | | 114 | | // public abstract IChannelFactory<IRequestChannel> CreateFederationProxy(EndpointAddress address, Binding bind |
| | | 115 | | public abstract XmlElement CreateKeySizeElement(int keySize); |
| | | 116 | | public abstract XmlElement CreateKeyTypeElement(SecurityKeyType keyType); |
| | | 117 | | public abstract XmlElement CreateTokenTypeElement(string tokenTypeUri); |
| | | 118 | | public abstract XmlElement CreateRequiredClaimsElement(IEnumerable<XmlElement> claimsList); |
| | | 119 | | public abstract XmlElement CreateUseKeyElement(SecurityKeyIdentifier keyIdentifier, SecurityStandardsManager sta |
| | | 120 | | public abstract XmlElement CreateSignWithElement(string signatureAlgorithm); |
| | | 121 | | public abstract XmlElement CreateEncryptWithElement(string encryptionAlgorithm); |
| | | 122 | | public abstract XmlElement CreateEncryptionAlgorithmElement(string encryptionAlgorithm); |
| | | 123 | | public abstract XmlElement CreateCanonicalizationAlgorithmElement(string canonicalicationAlgorithm); |
| | | 124 | | public abstract XmlElement CreateComputedKeyAlgorithmElement(string computedKeyAlgorithm); |
| | | 125 | | public abstract Collection<XmlElement> ProcessUnknownRequestParameters(Collection<XmlElement> unknownRequestPara |
| | | 126 | | public abstract bool TryParseKeySizeElement(XmlElement element, out int keySize); |
| | | 127 | | public abstract bool TryParseKeyTypeElement(XmlElement element, out SecurityKeyType keyType); |
| | | 128 | | public abstract bool TryParseTokenTypeElement(XmlElement element, out string tokenType); |
| | | 129 | | public abstract bool TryParseRequiredClaimsElement(XmlElement element, out Collection<XmlElement> requiredClaims |
| | | 130 | | // helper methods for the parsing standard binding elements |
| | 0 | 131 | | internal virtual bool IsSignWithElement(XmlElement element, out string signatureAlgorithm) { signatureAlgorithm |
| | 0 | 132 | | internal virtual bool IsEncryptWithElement(XmlElement element, out string encryptWithAlgorithm) { encryptWithAlg |
| | 0 | 133 | | internal virtual bool IsEncryptionAlgorithmElement(XmlElement element, out string encryptionAlgorithm) { encrypt |
| | 0 | 134 | | internal virtual bool IsCanonicalizationAlgorithmElement(XmlElement element, out string canonicalizationAlgorith |
| | 0 | 135 | | internal virtual bool IsKeyWrapAlgorithmElement(XmlElement element, out string keyWrapAlgorithm) { keyWrapAlgori |
| | | 136 | | } |
| | | 137 | | } |