Esempio n. 1
0
        }                                                           /* this simple sample uses a no op */

        /// <summary>
        /// Illustrate setting up a recovery rule more complex than "normal consumer"
        /// mode, without the "normal consumer" shortcuts.
        /// </summary>
        /// <param name="newMember">newly-created member we are setting up</param>
        /// <param name="tokenClient">SDK client</param>
        /// <param name="agentAlias">Alias of recovery agent.</param>
        public void SetUpComplexRecoveryRule(
            TppMember newMember,
            Tokenio.Tpp.TokenClient tokenClient,
            Alias agentAlias)
        {
            // setUpComplex begin snippet to include in docs
            // Someday in the future, this user might ask the recovery agent
            // "Please tell Token that I am the member with ID m:12345678 ."
            // While we're setting up this new member, we need to tell the
            // recovery agent the new member ID so the agent can "remember" later.
            TellRecoveryAgentMemberId(newMember.MemberId());

            string agentId = tokenClient.GetMemberIdBlocking(agentAlias);

            RecoveryRule recoveryRule = new RecoveryRule {
                PrimaryAgent = agentId
            };

            // This example doesn't call .setSecondaryAgents ,
            // but could have. If it had, then recovery would have
            // required one secondary agent authorization along with
            // the primary agent authorization.
            newMember.AddRecoveryRuleBlocking(recoveryRule);
            // setUpComplex done snippet to include in docs
        }
Esempio n. 2
0
 /// <summary>
 /// Adds the recovery rule.
 /// </summary>
 /// <param name="rule">the recovery rule</param>
 /// <returns>the updated member</returns>
 public Task <ProtoMember> AddRecoveryRule(RecoveryRule rule)
 {
     return(client.UpdateMember(new List <MemberOperation>
     {
         new MemberOperation
         {
             RecoveryRules = new MemberRecoveryRulesOperation
             {
                 RecoveryRule = rule
             }
         }
     }));
 }
Esempio n. 3
0
        /// <summary>
        /// Illustrate setting up a recovery rule more complex than "normal consumer"
        /// mode, without the "normal consumer" shortcuts.
        /// </summary>
        /// <param name="newMember">newly-created member we are setting up</param>
        /// <param name="tokenClient">SDK client</param>
        /// <param name="agentAlias"> Alias of recovery agent.</param>
        public void SetUpComplexRecoveryRule(
            Tokenio.Member newMember,
            TokenClient tokenClient,
            Alias agentAlias)
        {
            TellRecoveryAgentMemberId(newMember.MemberId());

            var agentId      = tokenClient.GetMemberId(agentAlias).Result;
            var recoveryRule = new RecoveryRule {
                PrimaryAgent = agentId
            };

            newMember.AddRecoveryRule(recoveryRule).Wait();
        }
Esempio n. 4
0
 /// <summary>
 /// Adds the recovery rule.
 /// </summary>
 /// <param name="rule">the recovery rule</param>
 /// <returns>the updated member</returns>
 public ProtoMember AddRecoveryRuleBlocking(RecoveryRule rule)
 {
     return(AddRecoveryRule(rule).Result);
 }