Skip to content

Commit

Permalink
Merge pull request #17 from Nasruddin/feature/authorization-server-impl
Browse files Browse the repository at this point in the history
cleaning oauth flow
  • Loading branch information
Nasruddin authored Mar 6, 2024
2 parents 93ed233 + 11bb5e7 commit 4bd88ef
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions config-repo/course-composite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ springdoc:
cache:
disabled: true
swagger-ui:
oauth2-redirect-url: https://localhost:8443/webjars/swagger-ui/oauth2-redirect.html
oauth2-redirect-url: http://localhost:8443/webjars/swagger-ui/oauth2-redirect.html
oauth:
clientId: writer
clientSecret: secret
useBasicAuthenticationWithAccessCodeGrant: true
oAuthFlow:
authorizationUrl: https://localhost:8443/oauth2/authorize
tokenUrl: https://localhost:8443/oauth2/token
authorizationUrl: http://localhost:8443/oauth2/authorize
tokenUrl: http://localhost:8443/oauth2/token

server.forward-headers-strategy: framework

Expand Down
Binary file added images/build.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/docker-compose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/docker-ps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/eureka.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/gateway-routes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/jwt-io.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/oauth-endpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package io.javatab.microservices.composite.course.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;

import static org.springframework.http.HttpMethod.*;

@Configuration
@EnableWebFluxSecurity
public class SecurityConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public RegisteredClientRepository registeredClientRepository() {
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
.authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN)
.authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)
.redirectUri("https://my.redirect.uri")
.redirectUri("https://localhost:8443/openapi/webjars/swagger-ui/oauth2-redirect.html")
.redirectUri("http://my.redirect.uri")
.redirectUri("http://localhost:8443/openapi/webjars/swagger-ui/oauth2-redirect.html")
.scope(OidcScopes.OPENID)
.scope("course:read")
.scope("course:write")
Expand All @@ -131,8 +131,8 @@ public RegisteredClientRepository registeredClientRepository() {
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
.authorizationGrantType(AuthorizationGrantType.REFRESH_TOKEN)
.authorizationGrantType(AuthorizationGrantType.CLIENT_CREDENTIALS)
.redirectUri("https://my.redirect.uri")
.redirectUri("https://localhost:8443/openapi/webjars/swagger-ui/oauth2-redirect.html")
.redirectUri("http://my.redirect.uri")
.redirectUri("http://localhost:8443/openapi/webjars/swagger-ui/oauth2-redirect.html")
.scope(OidcScopes.OPENID)
.scope("course:read")
.clientSettings(ClientSettings.builder().requireAuthorizationConsent(true).build())
Expand All @@ -157,7 +157,7 @@ public JwtDecoder jwtDecoder(JWKSource<SecurityContext> jwkSource) {

@Bean
public AuthorizationServerSettings authorizationServerSettings() {
return AuthorizationServerSettings.builder().issuer("http://auth-server").build();
return AuthorizationServerSettings.builder().issuer("http://auth-server:9999").build();
}

private Consumer<List<AuthenticationProvider>> configureAuthenticationValidator() {
Expand Down

0 comments on commit 4bd88ef

Please sign in to comment.