File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Auth/LearningHub.Nhs.Auth Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 2424builder . Host . UseNLog ( ) ;
2525
2626string corsOriginUrl = builder . Configuration . GetValue < string > ( "LearningHubAuthConfig:AuthClients:learninghubopenapi:BaseUrl" ) ;
27+ string corsMoodleUrl = builder . Configuration . GetValue < string > ( "MoodleAPIConfig:BaseUrl" ) ;
2728
2829builder . Services . AddCors ( options =>
2930{
3435 . AllowAnyHeader ( ) ) ;
3536} ) ;
3637
38+ builder . Services . AddCors ( options =>
39+ {
40+ options . AddPolicy ( "MoodleCORS" , builder =>
41+ {
42+ builder . WithOrigins ( corsMoodleUrl )
43+ . AllowAnyHeader ( )
44+ . AllowAnyMethod ( )
45+ . AllowCredentials ( ) ;
46+ } ) ;
47+ } ) ;
48+
3749builder . Services . ConfigureServices ( builder . Configuration , builder . Environment ) ;
3850
3951GlobalDiagnosticsContext . Set ( "connectionString" , builder . Configuration . GetSection ( "ASPNETCORE_ConnectionStrings" ) [ "NLogDb" ] ) ;
7284
7385app . UseCors ( "CorsPolicy" ) ;
7486
87+ app . UseCors ( "MoodleCORS" ) ;
88+
7589app . UseCookiePolicy ( ) ;
7690
7791app . UseHttpsRedirection ( ) ;
You can’t perform that action at this time.
0 commit comments