public LoginResponse LoginStandalone(Login login) { TransactionSecurity.GenerateSecret(); LoginResponse resp = UserAuthentication.AuthenticateStandalone(login); if (resp != null) { return(resp); } return(new LoginResponse()); }
public TokenResponse IssueToken(int assessmentId = -1, int aggregationId = -1, string refresh = "*default*", int expSeconds = -1) { // Get a few claims from the current token TokenManager tm = new TokenManager(); int currentUserId = (int)tm.PayloadInt(Constants.Token_UserId); int? currentAssessmentId = tm.PayloadInt(Constants.Token_AssessmentId); int? currentAggregationId = tm.PayloadInt(Constants.Token_AggregationId); string scope = tm.Payload(Constants.Token_Scope); // If the 'refresh' parm was sent, this is a pure refresh if (refresh != "*default*") { // If the token has an assess ID, validate the user/assessment if (currentAssessmentId != null) { Auth.AssessmentForUser(currentUserId, (int)currentAssessmentId); } } else { // If an assessmentId was sent, use that in the new token aftervalidating user/assessment if (assessmentId > 0) { Auth.AssessmentForUser(currentUserId, assessmentId); currentAssessmentId = assessmentId; } if (aggregationId > 0) { currentAggregationId = aggregationId; } } // If we make it this far, we can issue the new token with what we know to be current and valid string token = TransactionSecurity.GenerateToken( currentUserId, tm.Payload(Constants.Token_TimezoneOffsetKey), expSeconds, currentAssessmentId, currentAggregationId, scope); TokenResponse resp = new TokenResponse { Token = token }; return(resp); }
public void Configuration(IAppBuilder app) { //AreaRegistration.RegisterAllAreas(); //FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); //RouteConfig.RegisterRoutes(RouteTable.Routes); //BundleConfig.RegisterBundles(BundleTable.Bundles); //NotificationManager.SetConfigurationManager(new ConfigWrapper()); // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=316888 TransactionSecurity.GenerateSecret(); GlobalConfiguration.Configuration.UseSqlServerStorage("HangfireConn").UseConsole(); VersionHandler version = new VersionHandler(); VersionInjected.Version = version.CSETVersionString; app.UseHangfireDashboard(); app.UseHangfireServer(); //SwaggerConfig.Register(); //app.UseWebApi(WebApiConfig.Register()); }