Skip to content

Commit 837d22f

Browse files
committed
[keycloak-spi] add cors
1 parent cbe055e commit 837d22f

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/keycloak-ci-cd.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939

4040
build:
4141
name: Build and Push Docker Images
42-
if: github.ref == 'refs/heads/main'
4342
runs-on: ubuntu-latest
4443
needs: test
4544

@@ -68,7 +67,7 @@ jobs:
6867
with:
6968
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.IMAGE_NAME }}
7069
tags: |
71-
type=raw,value=latest,enable={{is_default_branch}}
70+
type=raw,value=latest,enable=true
7271
type=sha
7372
labels: |
7473
org.opencontainers.image.source=https://github.com/${{ github.repository }}
@@ -86,7 +85,6 @@ jobs:
8685

8786
deploy:
8887
name: Deploy to Rancher with Helm
89-
if: github.ref == 'refs/heads/main'
9088
runs-on: ubuntu-latest
9189
needs: build
9290

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.recipefy.keycloak.config;
2+
3+
import org.springframework.context.annotation.Configuration;
4+
import org.springframework.web.reactive.config.CorsRegistry;
5+
import org.springframework.web.reactive.config.WebFluxConfigurer;
6+
7+
@Configuration
8+
public class WebConfig implements WebFluxConfigurer {
9+
10+
@Override
11+
public void addCorsMappings(CorsRegistry registry) {
12+
registry.addMapping("/**")
13+
.allowedOriginPatterns("*")
14+
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
15+
.allowedHeaders("*")
16+
.allowCredentials(true)
17+
.maxAge(3600);
18+
}
19+
}

0 commit comments

Comments
 (0)