Test Watch console
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 3m11s
All checks were successful
CI/CD Pipeline / Build and Deploy with Docker Compose (push) Successful in 3m11s
This commit is contained in:
parent
4ae39a9ff2
commit
bfcda2ad9d
@ -255,8 +255,9 @@ namespace phronCare.API.Controllers
|
|||||||
{
|
{
|
||||||
authClaims.Add(new Claim(ClaimTypes.Role, role));
|
authClaims.Add(new Claim(ClaimTypes.Role, role));
|
||||||
}
|
}
|
||||||
|
|
||||||
var jwtToken = GetToken(authClaims);
|
var jwtToken = GetToken(authClaims);
|
||||||
/* Returning the User Session object */
|
|
||||||
var userSession = new UserSession
|
var userSession = new UserSession
|
||||||
{
|
{
|
||||||
UserName = user.UserName,
|
UserName = user.UserName,
|
||||||
@ -266,12 +267,6 @@ namespace phronCare.API.Controllers
|
|||||||
ExpiryTimeStamp = jwtToken.ValidTo
|
ExpiryTimeStamp = jwtToken.ValidTo
|
||||||
};
|
};
|
||||||
return Ok(userSession);
|
return Ok(userSession);
|
||||||
/* Returning simple jwt object */
|
|
||||||
//return Ok(new
|
|
||||||
//{
|
|
||||||
// token = new JwtSecurityTokenHandler().WriteToken(jwtToken),
|
|
||||||
// expiration = jwtToken.ValidTo
|
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
public class UserSession
|
public class UserSession
|
||||||
{
|
{
|
||||||
@ -307,19 +302,6 @@ namespace phronCare.API.Controllers
|
|||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
//private JwtSecurityToken GetToken(List<Claim> authClaims)
|
|
||||||
//{
|
|
||||||
// var authSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(configuration["JWT:Secret"]));
|
|
||||||
// var token = new JwtSecurityToken(
|
|
||||||
// issuer: configuration["JWT:ValidIssuer"],
|
|
||||||
// audience: configuration["JWT:ValidAudience"],
|
|
||||||
// expires: DateTime.Now.AddHours(JWT_TOKEN_VALIDITY_HOURS),
|
|
||||||
// claims: authClaims,
|
|
||||||
// signingCredentials: new SigningCredentials(authSigningKey, SecurityAlgorithms.HmacSha256Signature)
|
|
||||||
// );
|
|
||||||
// return token;
|
|
||||||
//}
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,6 +196,9 @@ builder.Services.AddCors(options =>
|
|||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
|
||||||
|
Console.WriteLine($"JWT Issuer: {configuration["JWT:ValidIssuer"]}");
|
||||||
|
Console.WriteLine($"JWT Audience: {configuration["JWT:ValidAudience"]}");
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
//if (app.Environment.IsDevelopment())
|
//if (app.Environment.IsDevelopment())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user