Skip to content

Commit

Permalink
fix the multiple bean issue
Browse files Browse the repository at this point in the history
Signed-off-by: liga-oz <[email protected]>
  • Loading branch information
liga-oz committed Feb 8, 2024
1 parent 1f1bc2e commit 36d7860
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
import com.sap.cloud.security.spring.token.authentication.XsuaaTokenAuthorizationConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.jwt.Jwt;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -23,7 +20,7 @@
public class XsuaaAuthzConverter {

@Bean
public Converter<Jwt, AbstractAuthenticationToken> multipleXsuaaConfigAuthzConverter(
public XsuaaTokenAuthorizationConverter multipleXsuaaConfigAuthzConverter(
XsuaaServiceConfigurations xsuaaConfigs) {
return new XsuaaTokenAuthorizationConverterExt (
xsuaaConfigs.getConfigurations().get(0).getProperty(APP_ID),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import static org.junit.jupiter.api.Assertions.assertNotNull;

@SpringBootTest
@java.lang.SuppressWarnings("squid:S2699")
@ActiveProfiles("multixsuaa") // properties are provided with /resources/application-multixsuaa.yml
class ApplicationTest {
@Autowired
XsuaaTokenFlows tokenflows;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;

import static org.junit.jupiter.api.Assertions.assertTrue;
Expand All @@ -25,7 +24,6 @@

@SpringBootTest
@AutoConfigureMockMvc
@ActiveProfiles("multixsuaa") // properties are provided with /resources/application-multixsuaa.yml
@ExtendWith(IasExtension.class)
class TestControllerIasTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;

import static org.junit.jupiter.api.Assertions.assertTrue;
Expand All @@ -26,7 +25,6 @@
@SpringBootTest
@AutoConfigureMockMvc
@ExtendWith(XsuaaExtension.class)
@ActiveProfiles("multixsuaa") // properties are provided with /resources/application-multixsuaa.yml
class TestControllerXsuaaTest {

@Autowired
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,34 @@
sap:
security:
services:
xsuaa:
xsuaa[0]:
xsappname: xsapp!t0815
uaadomain: localhost
clientid: sb-clientId!t0815
clientsecret: pwd
url: http://localhost
plan: application
xsuaa[1]:
xsappname: xsapp!b04711
clientid: sb-clientId!b04711
plan: broker

identity:
clientid: sb-clientId!t0815
domains: localhost
domains: localhost

#Single xsuaa service configuration
# xsuaa:
# xsappname: xsapp!t0815
# uaadomain: localhost
# clientid: sb-clientId!t0815
# clientsecret: pwd
# url: http://localhost
#
# identity:
# clientid: sb-clientId!t0815
# domains: localhost

logging.level:
com.sap: DEBUG # set SAP-class loggers to DEBUG.
org.springframework: DEBUG

0 comments on commit 36d7860

Please sign in to comment.