Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
meofiscoding committed Nov 19, 2023
1 parent b9c2d33 commit fab38af
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 51 deletions.
82 changes: 41 additions & 41 deletions Identity.API/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,48 +33,48 @@ public static class Config
AllowOfflineAccess = true,
RequireConsent = false
},
//new Client()
//{
// ClientName = "Angular-Client",
// ClientId = "angular-client",
// AllowedGrantTypes = GrantTypes.Code,
// RedirectUris = new List<string>{ "https://simplenetflix.vercel.app/signin-callback", "https://simplenetflix.vercel.app/assets/silent-callback.html" },
// RequirePkce = true,
// AllowAccessTokensViaBrowser = true,
// AllowedScopes =
// {
// IdentityServerConstants.StandardScopes.OpenId,
// IdentityServerConstants.StandardScopes.Profile,
// "movies"
// },
// AllowedCorsOrigins = { "https://simplenetflix.vercel.app" },
// RequireClientSecret = false,
// PostLogoutRedirectUris = new List<string> { "https://simplenetflix.vercel.app/signout-callback" },
// RequireConsent = false,
// AccessTokenLifetime = 600
//},
new Client()
{
ClientName = "Angular-Client",
ClientId = "angular-client",
AllowedGrantTypes = GrantTypes.Code,
RedirectUris = new List<string>{ "http://localhost:4200/signin-callback", "http://localhost:4200/assets/silent-callback.html" },
RequirePkce = true,
AllowAccessTokensViaBrowser = true,
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"movies",
"payment",
"roles"
},
AllowedCorsOrigins = { "http://localhost:4200" },
RequireClientSecret = false,
PostLogoutRedirectUris = new List<string> { "http://localhost:4200/signout-callback" },
RequireConsent = false,
AccessTokenLifetime = 600
}
{
ClientName = "Angular-Client",
ClientId = "angular-client",
AllowedGrantTypes = GrantTypes.Code,
RedirectUris = new List<string>{ "https://simplenetflix.vercel.app/signin-callback", "https://simplenetflix.vercel.app/assets/silent-callback.html" },
RequirePkce = true,
AllowAccessTokensViaBrowser = true,
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"movies"
},
AllowedCorsOrigins = { "https://simplenetflix.vercel.app" },
RequireClientSecret = false,
PostLogoutRedirectUris = new List<string> { "https://simplenetflix.vercel.app/signout-callback" },
RequireConsent = false,
AccessTokenLifetime = 600
},
//new Client()
// {
// ClientName = "Angular-Client",
// ClientId = "angular-client",
// AllowedGrantTypes = GrantTypes.Code,
// RedirectUris = new List<string>{ "http://localhost:4200/signin-callback", "http://localhost:4200/assets/silent-callback.html" },
// RequirePkce = true,
// AllowAccessTokensViaBrowser = true,
// AllowedScopes =
// {
// IdentityServerConstants.StandardScopes.OpenId,
// IdentityServerConstants.StandardScopes.Profile,
// "movies",
// "payment",
// "roles"
// },
// AllowedCorsOrigins = { "http://localhost:4200" },
// RequireClientSecret = false,
// PostLogoutRedirectUris = new List<string> { "http://localhost:4200/signout-callback" },
// RequireConsent = false,
// AccessTokenLifetime = 600
// }
};

public static IEnumerable<ApiScope> ApiScopes =>
Expand Down
6 changes: 0 additions & 6 deletions Identity.API/Controllers/AuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ public async Task<IActionResult> Login(LoginViewModel vm)
return View(vm);
}

var useRoles = await _userManager.GetRolesAsync(user);
var authClaim = new List<Claim>(){
new Claim(ClaimTypes.Email, user.Email),
new Claim (JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
};

var signInResult = _signInManager.PasswordSignInAsync(user, vm.Password, false, false).Result;
if (signInResult.Succeeded)
{
Expand Down
4 changes: 1 addition & 3 deletions Identity.API/Data/AppDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ namespace Identity.API.Data
{
public class AppDbContext : IdentityDbContext<ApplicationUser>, IDataProtectionKeyContext
{
protected readonly IConfiguration Configuration;
public AppDbContext(DbContextOptions<AppDbContext> options, IConfiguration configuration) : base(options)
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
Configuration = configuration;
}

public DbSet<DataProtectionKey> DataProtectionKeys { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Identity.API/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
// "Protocols": "Http2"
// }
//},
"IdentityUrl": "http://localhost:5286"
"IdentityUrl": "https://localhost:7096"
}

0 comments on commit fab38af

Please sign in to comment.