public async Task <IActionResult> LoginDevelopment(string userName) { if (_env.IsProduction() || string.IsNullOrWhiteSpace(userName)) { return(Unauthorized()); } HttpContext.Session.Clear(); var secToken = await CreateDevTokenForIdir(userName); SiteMinderAuthenticationToken.AddToResponse(secToken, Response); return(LocalRedirect($"{Configuration["BASE_PATH"]}/login")); }
public async Task <IActionResult> LoginDevelopment(string userName) { if (env.IsProduction() || string.IsNullOrWhiteSpace(userName)) { return(Unauthorized()); } HttpContext.Session.Clear(); var secToken = await(userName.StartsWith("idir", StringComparison.OrdinalIgnoreCase) ? CreateDevTokenForIdir(userName) : CreateDevTokenForBceid(userName) ); SiteMinderAuthenticationToken.AddToResponse(secToken, Response); return(LocalRedirect($"{configuration.GetBasePath()}/login")); }
private async Task <SiteMinderAuthenticationToken> CreateDevTokenForBceid(string userName) { var volunteer = await dataInterface.GetVolunteerByBceidUserNameAsync(userName); if (volunteer == null) { return(null); } var secToken = new SiteMinderAuthenticationToken { smgov_businessguid = volunteer.Organization.BCeIDBusinessGuid, smgov_businesslegalname = volunteer.Organization.LegalName, smgov_userdisplayname = $"{volunteer.LastName}, {volunteer.FirstName}", smgov_userguid = volunteer.Externaluseridentifier ?? Guid.NewGuid().ToString(), smgov_usertype = "business", sm_universalid = volunteer.BceidAccountNumber, sm_user = volunteer.BceidAccountNumber }; return(secToken); }