public SupportingTokenProviderSpecification(SecurityTokenProvider tokenProvider, SecurityTokenAttachmentMode attachmentMode, SecurityTokenParameters tokenParameters)
 {
     SecurityTokenAttachmentModeHelper.Validate(attachmentMode);
     TokenProvider = tokenProvider ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(tokenProvider));
     SecurityTokenAttachmentMode = attachmentMode;
     TokenParameters             = tokenParameters ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(tokenParameters));
 }
Example #2
0
 public SupportingTokenSpecification(SecurityToken token, ReadOnlyCollection <IAuthorizationPolicy> tokenPolicies, SecurityTokenAttachmentMode attachmentMode, SecurityTokenParameters tokenParameters)
     : base(token, tokenPolicies)
 {
     SecurityTokenAttachmentModeHelper.Validate(attachmentMode);
     SecurityTokenAttachmentMode = attachmentMode;
     SecurityTokenParameters     = tokenParameters;
 }
Example #3
0
        internal static void Categorize(SecurityTokenAttachmentMode value,
                                        out bool isBasic, out bool isSignedButNotBasic, out ReceiveSecurityHeaderBindingModes mode)
        {
            SecurityTokenAttachmentModeHelper.Validate(value);

            switch (value)
            {
            case SecurityTokenAttachmentMode.Endorsing:
                isBasic             = false;
                isSignedButNotBasic = false;
                mode = ReceiveSecurityHeaderBindingModes.Endorsing;
                break;

            case SecurityTokenAttachmentMode.Signed:
                isBasic             = false;
                isSignedButNotBasic = true;
                mode = ReceiveSecurityHeaderBindingModes.Signed;
                break;

            case SecurityTokenAttachmentMode.SignedEncrypted:
                isBasic             = true;
                isSignedButNotBasic = false;
                mode = ReceiveSecurityHeaderBindingModes.Basic;
                break;

            case SecurityTokenAttachmentMode.SignedEndorsing:
                isBasic             = false;
                isSignedButNotBasic = true;
                mode = ReceiveSecurityHeaderBindingModes.SignedEndorsing;
                break;

            default:
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value"));
            }
        }
 internal SupportingTokenAuthenticatorSpecification(SecurityTokenAuthenticator tokenAuthenticator, SecurityTokenResolver securityTokenResolver, SecurityTokenAttachmentMode attachmentMode, SecurityTokenParameters tokenParameters, bool isTokenOptional)
 {
     SecurityTokenAttachmentModeHelper.Validate(attachmentMode);
     TokenAuthenticator          = tokenAuthenticator ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(tokenAuthenticator));
     TokenResolver               = securityTokenResolver;
     SecurityTokenAttachmentMode = attachmentMode;
     TokenParameters             = tokenParameters ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(tokenParameters));
     IsTokenOptional             = isTokenOptional;
 }
Example #5
0
        internal SupportingTokenAuthenticatorSpecification(SecurityTokenAuthenticator tokenAuthenticator, SecurityTokenResolver securityTokenResolver, SecurityTokenAttachmentMode attachmentMode, SecurityTokenParameters tokenParameters, bool isTokenOptional)
        {
            if (tokenAuthenticator == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("tokenAuthenticator");
            }

            SecurityTokenAttachmentModeHelper.Validate(attachmentMode);

            if (tokenParameters == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("tokenParameters");
            }
            this.TokenAuthenticator          = tokenAuthenticator;
            this.TokenResolver               = securityTokenResolver;
            this.SecurityTokenAttachmentMode = attachmentMode;
            this.TokenParameters             = tokenParameters;
            this.isTokenOptional             = isTokenOptional;
        }