Skip to content

Fixed Auth bug introduced by CORS #871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 7, 2025
Merged

Conversation

AmeyaKulkarni2001
Copy link
Contributor

Please review the changes, feel free to ask any questions / any other testcases which need to be tested

This PR aims to fix the below issue
#863 which was introduced by #859 change

List of changes

  1. Using CORS filter instead of CORS mapping
  2. Using @Order and @Conditional bean
  3. Changing the config for CORS values

Test cases :

  1. Testing for auth
name: db2rest-security

resourceRoles:
  - resource: "/v1/rdbms/db/**"
    method: get
    roles:
      - admin
  - resource: "/v1/rdbms/db/**"
    method: post
    roles:
      - admin

apiKeys:
  - key: 123456
    roles: [admin]
    active: true
cors:
  enabled: ${ENABLE_CORS:false}
  mappings:
    - mapping: "/actor/**"
      allowedOrigin: "http://localhost:3000"
      allowedHeader: "*"
      allowedMethod: "*"
    - mapping: "/v1/rdbms/db/**"
      allowedOrigin: "http://localhost:4200, http://localhost:3000"
      allowedHeader: "*"
      allowedMethod: "GET,POST"

Below is the angular send req
image

Proof of working from localhost:3000 as well as localhost:4200
image
image

@kdhrubo kdhrubo merged commit 3826a2d into 9tigerio:master Mar 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants