Example #1
0
        //=======================================================================================
        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.

        /*
         * // We demand full trust because we use CoordinationServiceSecurity from a non-APTCA assembly and CoordinationServiceSecurity.GetIssuedToken(..) can call Environment.FailFast.
         * // It's recommended to not let partially trusted callers to bring down the process.
         * // WSATs are not supported in partial trust, so customers should not be broken by this demand.
         * [PermissionSet(SecurityAction.Demand, Unrestricted = true)]
         */
        public override TransactionInfo ReadTransaction(Message message)
        {
            EnsureInitialized();

            CoordinationContext context = WsatTransactionHeader.GetCoordinationContext(message, this.protocolVersion);

            if (context == null)
            {
                return(null);
            }

            // Incoming transaction tokens are optional
            RequestSecurityTokenResponse issuedToken;

            try
            {
                issuedToken = CoordinationServiceSecurity.GetIssuedToken(message, context.Identifier, this.protocolVersion);
            }
            catch (XmlException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          new TransactionException(SR.FailedToDeserializeIssuedToken, e));
            }

            return(new WsatTransactionInfo(this.wsatProxy, context, issuedToken));
        }
Example #2
0
        public override void WriteTransaction(Transaction transaction, Message message)
        {
            CoordinationContext          context;
            RequestSecurityTokenResponse response;

            this.EnsureInitialized();
            this.ForcePromotion(transaction);
            this.MarshalAsCoordinationContext(transaction, out context, out response);
            if (response != null)
            {
                CoordinationServiceSecurity.AddIssuedToken(message, response);
            }
            WsatTransactionHeader header = new WsatTransactionHeader(context, this.protocolVersion);

            message.Headers.Add(header);
        }
        //=======================================================================================
        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.
        /*
        [PermissionSet(SecurityAction.Demand, Unrestricted = true)] // because we call code from a non-APTCA assembly; WSATs are not supported in partial trust, so customers should not be broken by this demand
        */
        public override void WriteTransaction(Transaction transaction, Message message)
        {
            EnsureInitialized();

            ForcePromotion(transaction);

            // Make a context and add it to the message
            CoordinationContext context;
            RequestSecurityTokenResponse issuedToken;
            MarshalAsCoordinationContext(transaction, out context, out issuedToken);
            if (issuedToken != null)
            {
                CoordinationServiceSecurity.AddIssuedToken(message, issuedToken);
            }

            WsatTransactionHeader header = new WsatTransactionHeader(context, this.protocolVersion);
            message.Headers.Add(header);
        }
Example #4
0
        //=======================================================================================
        // The demand is not added now (in 4.5), to avoid a breaking change. To be considered in the next version.

        /*
         * [PermissionSet(SecurityAction.Demand, Unrestricted = true)] // because we call code from a non-APTCA assembly; WSATs are not supported in partial trust, so customers should not be broken by this demand
         */
        public override void WriteTransaction(Transaction transaction, Message message)
        {
            EnsureInitialized();

            ForcePromotion(transaction);

            // Make a context and add it to the message
            CoordinationContext          context;
            RequestSecurityTokenResponse issuedToken;

            MarshalAsCoordinationContext(transaction, out context, out issuedToken);
            if (issuedToken != null)
            {
                CoordinationServiceSecurity.AddIssuedToken(message, issuedToken);
            }

            WsatTransactionHeader header = new WsatTransactionHeader(context, this.protocolVersion);

            message.Headers.Add(header);
        }
 public override void WriteTransaction(Transaction transaction, Message message)
 {
     CoordinationContext context;
     RequestSecurityTokenResponse response;
     this.EnsureInitialized();
     this.ForcePromotion(transaction);
     this.MarshalAsCoordinationContext(transaction, out context, out response);
     if (response != null)
     {
         CoordinationServiceSecurity.AddIssuedToken(message, response);
     }
     WsatTransactionHeader header = new WsatTransactionHeader(context, this.protocolVersion);
     message.Headers.Add(header);
 }