Ejemplo n.º 1
0
 /// <summary>
 /// Sets the On-Behalf-Of authentication value to be used
 /// with this client.The value must correspond to an existing
 /// Access Token ID issued for the client member.Uses the given customer
 /// initiated flag.
 ///
 /// </summary>
 /// <param name="accessTokenId">the access token id to be used</param>
 /// <param name="customerTrackingMetadata">the tracking metadata of the customer</param>
 private void UseAccessToken(
     string accessTokenId,
     CustomerTrackingMetadata customerTrackingMetadata)
 {
     onBehalfOf                    = accessTokenId;
     customerInitiated             = true;
     this.customerTrackingMetadata = customerTrackingMetadata;
 }
Ejemplo n.º 2
0
 public AuthenticationContext(
     string onBehalfOf,
     Level keyLevel,
     bool customerInitiated,
     CustomerTrackingMetadata securityMetadata)
 {
     this.onBehalfOf               = onBehalfOf;
     this.keyLevel                 = keyLevel;
     this.customerInitiated        = customerInitiated;
     this.customerTrackingMetadata = securityMetadata;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a {@link Representable} that acts as another member using the access token
        /// that was granted by that member.
        /// </summary>
        /// <param name="tokenId">the access token id to be used</param>
        /// <param name="customerTrackingMetadata">customer tracking data</param>
        /// <returns></returns>
        public IRepresentable ForAccessToken(
            string tokenId,
            CustomerTrackingMetadata customerTrackingMetadata)
        {
            var cloned = client.ForAccessToken(tokenId,
                                               customerTrackingMetadata);

            return(new Member(memberId,
                              cloned,
                              tokenCluster,
                              partnerId,
                              realmId));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new instance with On-Behalf-Of authentication set.
        /// </summary>
        /// <param name="tokenId">access token ID to be used</param>
        /// <param name="customerTrackingMetadata">customer tracking metadata</param>
        /// <returns>new client instance</returns>
        public Client ForAccessToken(
            string tokenId,
            CustomerTrackingMetadata customerTrackingMetadata)
        {
            if (customerTrackingMetadata.Equals(new CustomerTrackingMetadata()))
            {
                throw new RpcException(
                          new Status(StatusCode.InvalidArgument,
                                     "User tracking metadata is empty. "
                                     + "Use forAccessToken(String, boolean) instead."));
            }
            var updated = new Client(MemberId, cryptoEngine, channel);

            updated.UseAccessToken(tokenId, customerTrackingMetadata);
            return(updated);
        }