Пример #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(
            UserMember newMember,
            Tokenio.User.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
        }