コード例 #1
0
ファイル: TicketsTests.cs プロジェクト: xblazor2020/auth0.net
        public async Task Test_tickets_sequence()
        {
            // Send email verification ticket
            var verificationTicketRequest = new EmailVerificationTicketRequest
            {
                UserId    = _auth0User.UserId,
                ResultUrl = "http://www.nonexistingdomain.aaa/success"
            };
            var verificationTicketResponse = await _apiClient.Tickets.CreateEmailVerificationTicketAsync(verificationTicketRequest);

            verificationTicketResponse.Should().NotBeNull();
            verificationTicketResponse.Value.Should().NotBeNull();

            // Send password change ticket
            var changeTicketRequest = new PasswordChangeTicketRequest
            {
                UserId                 = _auth0User.UserId,
                ResultUrl              = "http://www.nonexistingdomain.aaa/success",
                MarkEmailAsVerified    = true,
                IncludeEmailInRedirect = true
            };
            var changeTicketRsponse = await _apiClient.Tickets.CreatePasswordChangeTicketAsync(changeTicketRequest);

            changeTicketRsponse.Should().NotBeNull();
            changeTicketRsponse.Value.Should().NotBeNull();
        }
コード例 #2
0
        public async Task Test_tickets_sequence()
        {
            // Send email verification ticket
            var verificationTicketRequest = new EmailVerificationTicketRequest
            {
                UserId    = user.UserId,
                ResultUrl = "http://www.nonexistingdomain.aaa/success"
            };
            var verificationTicketResponse = await apiClient.Tickets.CreateEmailVerificationTicketAsync(verificationTicketRequest);

            verificationTicketResponse.Should().NotBeNull();
            verificationTicketResponse.Value.Should().NotBeNull();

            // Send password change ticket
            var changeTicketRequest = new PasswordChangeTicketRequest
            {
                UserId      = user.UserId,
                ResultUrl   = "http://www.nonexistingdomain.aaa/success",
                NewPassword = "******"
            };
            var changeTicketRsponse = await apiClient.Tickets.CreatePasswordChangeTicketAsync(changeTicketRequest);

            changeTicketRsponse.Should().NotBeNull();
            changeTicketRsponse.Value.Should().NotBeNull();
        }
        public async Task <string> GetChangePasswordUrl(Domain.User.User internalUser, CancellationToken cancellationToken = default)
        {
            var client = await _auth0ManagementApiClientCreator.GetClient(cancellationToken);

            var passwordChangeTicketRequest = new PasswordChangeTicketRequest
            {
                UserId = string.Concat("auth0|", internalUser.Id.ToString()),
                MarkEmailAsVerified    = true,
                ResultUrl              = _environmentSettings.Auth0.RedirectUrl,
                IncludeEmailInRedirect = true,
                Ttl = 604800 // one week
            };

            return((await client.Tickets.CreatePasswordChangeTicketAsync(passwordChangeTicketRequest, cancellationToken)).Value);
        }
コード例 #4
0
ファイル: TicketsTests.cs プロジェクト: scott-carl/auth0.net
        public async Task Test_tickets_sequence()
        {
            var existingOrganizationId = "org_Jif6mLeWXT5ec0nu";

            await _apiClient.Organizations.AddMembersAsync(existingOrganizationId, new OrganizationAddMembersRequest
            {
                Members = new List <string> {
                    _auth0User.UserId
                }
            });

            // Send email verification ticket
            var verificationTicketRequest = new EmailVerificationTicketRequest
            {
                UserId         = _auth0User.UserId,
                OrganizationId = "org_Jif6mLeWXT5ec0nu"
            };
            var verificationTicketResponse = await _apiClient.Tickets.CreateEmailVerificationTicketAsync(verificationTicketRequest);

            verificationTicketResponse.Should().NotBeNull();
            verificationTicketResponse.Value.Should().NotBeNull();

            // Send password change ticket
            var changeTicketRequest = new PasswordChangeTicketRequest
            {
                UserId                 = _auth0User.UserId,
                ResultUrl              = "http://www.nonexistingdomain.aaa/success",
                MarkEmailAsVerified    = true,
                IncludeEmailInRedirect = true,
            };
            var changeTicketRsponse = await _apiClient.Tickets.CreatePasswordChangeTicketAsync(changeTicketRequest);

            changeTicketRsponse.Should().NotBeNull();
            changeTicketRsponse.Value.Should().NotBeNull();

            await _apiClient.Organizations.DeleteMemberAsync(existingOrganizationId, new OrganizationDeleteMembersRequest
            {
                Members = new List <string> {
                    _auth0User.UserId
                }
            });
        }
コード例 #5
0
 /// <summary>
 /// Creates a password change ticket.
 /// </summary>
 /// <param name="request">The <see cref="PasswordChangeTicketRequest" /> containing the details of the ticket to create.</param>
 /// <returns>The <see cref="Ticket" />.</returns>
 public Task <Ticket> CreatePasswordChangeTicketAsync(PasswordChangeTicketRequest request)
 {
     return(Connection.PostAsync <Ticket>("tickets/password-change", request, null, null, null, null, null));
 }
コード例 #6
0
 public Task <Ticket> CreatePasswordChangeTicket(PasswordChangeTicketRequest request)
 {
     return(CreatePasswordChangeTicketAsync(request));
 }
コード例 #7
0
 /// <summary>
 /// Creates a password change ticket.
 /// </summary>
 /// <param name="request">The <see cref="PasswordChangeTicketRequest"/> containing the details of the ticket to create.</param>
 /// <returns>The newly created <see cref="Ticket"/>.</returns>
 public Task <Ticket> CreatePasswordChangeTicketAsync(PasswordChangeTicketRequest request)
 {
     return(Connection.SendAsync <Ticket>(HttpMethod.Post, BuildUri("tickets/password-change"), request, DefaultHeaders));
 }