This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring.security.oauth2.client.registration.<identifier>.authorization-grant-type=client_credentials | |
spring.security.oauth2.client.registration.<identifier>.client-id=client_id | |
spring.security.oauth2.client.registration.<identifier>.client-secret=client_secret | |
spring.security.oauth2.client.provider.<identifier>.token-uri=http://localhost:8353/oauth/token |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\--oauth2-spring-boot-client - Root | |
| .gitignore - Git management for ignoring not required files | |
| pom.xml - Maven pom.xml | |
+---src | |
| +---main | |
| | +---java | |
| | | \---in | |
| | | \---neuw | |
| | | \---oauth2 | |
| | | | Oauth2SpringBootClientApplication.java - The SpringBootApplication main class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.port=8533 | |
spring.security.oauth2.client.registration.local.authorization-grant-type=client_credentials | |
spring.security.oauth2.client.registration.local.client-id=client_id | |
spring.security.oauth2.client.registration.local.client-secret=client_secret | |
oauth2.client.provider.local.token-uri.base-path=https://localhost:8353 | |
spring.security.oauth2.client.provider.local.token-uri=${oauth2.client.provider.local.token-uri.base-path}/oauth/token | |
oauth2.client.registration.local.ssl-enabled=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pass the base 64 encoded String of the Keystore and keystore password | |
KeyManagerFactory keyManagerFactory = SSLContextHelper.getKeyStore(encodedKeystoreString, keystorePassword); | |
// pass the base 64 encoded String of the Truststore and truststore password | |
TrustManagerFactory trustManagerFactory = SSLContextHelper.getTrustStore(encodedTruststoreString, truststorePassword); | |
// Construct the SslContext using keyManagerFactory & trustManagerFactory | |
SslContext sslContext = SSLContextHelper.sslContext(keyManagerFactory, trustManagerFactory); | |
HttpClient resourceServerHttpClient = HttpClient.create() | |
.tcpConfiguration(client -> client.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000)) | |
.secure(sslContextSpec -> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
fun springSecurityFilterChain(http: ServerHttpSecurity): SecurityWebFilterChain? { | |
val httpClient = HttpClient.create() | |
.tcpConfiguration{client -> client.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000)} | |
.secure { sslContextSpec: SslProvider.SslContextSpec -> sslContextSpec.sslContext(sslContextBuilder(keyStoreContent, keyStorePassword, trustStoreContent, trustStorePassword)) } | |
val httpConnector: ClientHttpConnector = ReactorClientHttpConnector(httpClient) | |
val builder = NimbusReactiveJwtDecoder | |
.withJwkSetUri("https://<host>/.well-known/jwks.json") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-parent</artifactId> | |
<version>2.3.1.RELEASE</version> | |
<relativePath /> | |
<!-- lookup parent from repository --> | |
</parent> | |
<groupId>in.neuw</groupId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package in.neuw.apis; | |
import io.swagger.v3.oas.annotations.OpenAPIDefinition; | |
import io.swagger.v3.oas.annotations.info.Info; | |
import io.swagger.v3.oas.models.Components; | |
import io.swagger.v3.oas.models.OpenAPI; | |
import io.swagger.v3.oas.models.security.SecurityRequirement; | |
import io.swagger.v3.oas.models.security.SecurityScheme; | |
@SpringBootApplication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.web.bind.annotation.*; | |
import org.springframework.web.server.ServerWebExchange; | |
import reactor.core.publisher.Mono; | |
import javax.validation.Valid; | |
/** | |
* @author Karanbir Singh on 07/23/2020 | |
*/ | |
@RestController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.swagger.v3.oas.annotations.Operation; | |
import io.swagger.v3.oas.annotations.Parameter; | |
import io.swagger.v3.oas.annotations.enums.ParameterIn; | |
import io.swagger.v3.oas.annotations.tags.Tag; | |
import org.springframework.web.bind.annotation.*; | |
import org.springframework.web.server.ServerWebExchange; | |
import reactor.core.publisher.Mono; | |
import javax.validation.Valid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resilience4j: | |
circuitbreaker: | |
instances: | |
mockService: | |
slidingWindowSize: 3 | |
slidingWindowType: COUNT_BASED | |
#waitDurationInOpenState: 5 | |
waitInterval: 10000 | |
failureRateThreshold: 50 | |
permittedNumberOfCallsInHalfOpenState: 5 |