Skip to content

Commit

Permalink
Merge pull request #24 from MahdiyarGHD/develop
Browse files Browse the repository at this point in the history
feat: Implemented reset password tokens
  • Loading branch information
Ali-YousefiTelori authored Feb 27, 2024
2 parents fdd4a2c + ee6b399 commit c499e83
Show file tree
Hide file tree
Showing 18 changed files with 1,083 additions and 147 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,153 @@
}
}
}
},
"/api/ResetPassword/GenerateResetPasswordToken": {
"post": {
"tags": [
"ResetPassword"
],
"operationId": "GenerateResetPasswordToken",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenerateResetPasswordTokenRequestContract"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/GenerateResetPasswordTokenRequestContract"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/GenerateResetPasswordTokenRequestContract"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/GenerateResetPasswordTokenResponseContractMessageContract"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenerateResetPasswordTokenResponseContractMessageContract"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/GenerateResetPasswordTokenResponseContractMessageContract"
}
}
}
}
}
}
},
"/api/ResetPassword/ValidateResetPasswordToken": {
"post": {
"tags": [
"ResetPassword"
],
"operationId": "ValidateResetPasswordToken",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidateResetPasswordTokenRequestContract"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/ValidateResetPasswordTokenRequestContract"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/ValidateResetPasswordTokenRequestContract"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/MessageContract"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/MessageContract"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/MessageContract"
}
}
}
}
}
}
},
"/api/ResetPassword/ConsumeResetPasswordToken": {
"post": {
"tags": [
"ResetPassword"
],
"operationId": "ConsumeResetPasswordToken",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ConsumeResetPasswordTokenRequestContract"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/ConsumeResetPasswordTokenRequestContract"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/ConsumeResetPasswordTokenRequestContract"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/MessageContract"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/MessageContract"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/MessageContract"
}
}
}
}
}
}
}
},
"components": {
Expand Down Expand Up @@ -429,6 +576,20 @@
}
}
},
"ConsumeResetPasswordTokenRequestContract": {
"type": "object",
"additionalProperties": false,
"properties": {
"token": {
"type": "string",
"nullable": true
},
"password": {
"type": "string",
"nullable": true
}
}
},
"ErrorContract": {
"type": "object",
"additionalProperties": false,
Expand Down Expand Up @@ -519,6 +680,53 @@
16
]
},
"GenerateResetPasswordTokenRequestContract": {
"type": "object",
"additionalProperties": false,
"properties": {
"whiteLabelKey": {
"type": "string",
"nullable": true
},
"expireTimeInSeconds": {
"type": "integer",
"format": "int64"
},
"userName": {
"type": "string",
"nullable": true
}
}
},
"GenerateResetPasswordTokenResponseContract": {
"type": "object",
"additionalProperties": false,
"properties": {
"token": {
"type": "string",
"nullable": true
}
}
},
"GenerateResetPasswordTokenResponseContractMessageContract": {
"title": "MessageContract<GenerateResetPasswordTokenResponseContract>",
"type": "object",
"additionalProperties": false,
"properties": {
"isSuccess": {
"type": "boolean"
},
"error": {
"$ref": "#/components/schemas/ErrorContract"
},
"success": {
"$ref": "#/components/schemas/SuccessContract"
},
"result": {
"$ref": "#/components/schemas/GenerateResetPasswordTokenResponseContract"
}
}
},
"LoginByPersonalAccessTokenRequestContract": {
"type": "object",
"additionalProperties": false,
Expand Down Expand Up @@ -725,6 +933,16 @@
}
}
},
"ValidateResetPasswordTokenRequestContract": {
"type": "object",
"additionalProperties": false,
"properties": {
"token": {
"type": "string",
"nullable": true
}
}
},
"ValidationContract": {
"type": "object",
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<IsPackable>true</IsPackable>
<Version>0.0.0.6</Version>
<Version>0.0.0.9</Version>
<Description>client generated code.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>microservice,Identity,Identity,client</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public IdentityContext(IEntityFrameworkCoreDatabaseBuilder builder) : base(build
{
}

//public DbSet<IdentityEntity> Identity { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

<ItemGroup>
<PackageReference Include="EasyMicroservices.Configuration" Version="0.0.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.26" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyMicroservices.IdentityMicroservice.Contracts.Requests
{
public class ConsumeResetPasswordTokenRequestContract
{
public string Token { get; set; }
public string Password { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyMicroservices.IdentityMicroservice.Contracts.Requests
{
public class GenerateResetPasswordTokenRequestContract
{
public string WhiteLabelKey { get; set; }
public long ExpireTimeInSeconds { get; set; }
public string UserName { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyMicroservices.IdentityMicroservice.Contracts.Requests
{
public class ValidateResetPasswordTokenRequestContract
{
public string Token { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyMicroservices.IdentityMicroservice.Contracts.Responses
{
public class GenerateResetPasswordTokenResponseContract
{
public string Token { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Cores.AspEntityFrameworkCoreApi" Version="0.0.1.44" />
<PackageReference Include="EasyMicroservices.Cores.AspEntityFrameworkCoreApi" Version="0.0.1.59" />
<PackageReference Include="EasyMicroservices.Logger" Version="0.0.0.6" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EasyMicroservices.Mapper.CompileTimeMapper" Version="0.0.0.6" />
<PackageReference Include="EasyMicroservices.Mapper.SerializerMapper" Version="0.0.0.3" />
<PackageReference Include="EasyMicroservices.Mapper.CompileTimeMapper" Version="0.0.0.7" />
<PackageReference Include="EasyMicroservices.Mapper.SerializerMapper" Version="0.0.0.7" />
<PackageReference Include="EasyMicroservices.Security" Version="0.0.0.3" />
<PackageReference Include="EasyMicroservices.Serialization.Newtonsoft.Json" Version="0.0.0.9" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.2.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
using EasyMicroservices.Cores.Models;
using EasyMicroservices.IdentityMicroservice.Interfaces;
using EasyMicroservices.Logger.Interfaces;
using EasyMicroservices.Security;
using EasyMicroservices.Security.Interfaces;
using EasyMicroservices.Security.Providers.HashProviders;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using WhiteLables.GeneratedServices;

namespace EasyMicroservices.IdentityMicroservice.Helpers
Expand All @@ -30,6 +34,11 @@ public IConfiguration GetConfiguration()
return _service.GetService<IConfiguration>();
}

public SHA256HashProvider GetSHA256HashProvider()
{
return _service.GetService<SHA256HashProvider>();
}

public IdentityHelper GetIdentityHelper()
{
return _service.GetService<IdentityHelper>();
Expand Down Expand Up @@ -82,6 +91,11 @@ public RoleClient GetRoleClient()
return InternalLogin(new RoleClient(GetValue("Authentication"), CurrentHttpClient));
}

public ResetPasswordTokenClient GetResetPasswordTokenClientClient()
{
return InternalLogin(new ResetPasswordTokenClient(GetValue("Authentication"), CurrentHttpClient));
}

public PersonalAccessTokenClient GetPersonalAccessTokenClientClient()
{
return InternalLogin(new PersonalAccessTokenClient(GetValue("Authentication"), CurrentHttpClient));
Expand Down
Loading

0 comments on commit c499e83

Please sign in to comment.