-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: German Osin <[email protected]>
- Loading branch information
1 parent
bacf1b4
commit 517502b
Showing
12 changed files
with
275 additions
and
138 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
21 |
39 changes: 34 additions & 5 deletions
39
api/src/main/java/io/kafbat/ui/config/auth/AbstractAuthSecurityConfig.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,53 @@ | ||
package io.kafbat.ui.config.auth; | ||
|
||
import io.kafbat.ui.util.EmptyRedirectStrategy; | ||
import java.net.URI; | ||
import org.springframework.security.web.server.authentication.RedirectServerAuthenticationSuccessHandler; | ||
import org.springframework.security.web.server.authentication.logout.RedirectServerLogoutSuccessHandler; | ||
|
||
abstract class AbstractAuthSecurityConfig { | ||
|
||
protected AbstractAuthSecurityConfig() { | ||
|
||
} | ||
|
||
protected static final String LOGIN_URL = "/login"; | ||
protected static final String LOGOUT_URL = "/auth?logout"; | ||
|
||
protected static final String[] AUTH_WHITELIST = { | ||
"/css/**", | ||
"/js/**", | ||
"/media/**", | ||
/* STATIC */ | ||
"/index.html", | ||
"/assets/**", | ||
"/manifest.json", | ||
"/favicon.svg", | ||
"/favicon/**", | ||
|
||
"/static/**", | ||
"/resources/**", | ||
|
||
/* ACTUATOR */ | ||
"/actuator/health/**", | ||
"/actuator/info", | ||
"/actuator/prometheus", | ||
"/auth", | ||
|
||
/* AUTH */ | ||
"/login", | ||
"/logout", | ||
"/oauth2/**", | ||
"/static/**" | ||
"/api/config/authentication", | ||
"/api/authorization" | ||
}; | ||
|
||
protected RedirectServerAuthenticationSuccessHandler emptyRedirectSuccessHandler() { | ||
final var authHandler = new RedirectServerAuthenticationSuccessHandler(); | ||
authHandler.setRedirectStrategy(new EmptyRedirectStrategy()); | ||
return authHandler; | ||
} | ||
|
||
protected RedirectServerLogoutSuccessHandler redirectLogoutSuccessHandler() { | ||
final var logoutSuccessHandler = new RedirectServerLogoutSuccessHandler(); | ||
logoutSuccessHandler.setLogoutSuccessUrl(URI.create(LOGOUT_URL)); | ||
return logoutSuccessHandler; | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
99 changes: 0 additions & 99 deletions
99
api/src/main/java/io/kafbat/ui/controller/AuthController.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
api/src/main/java/io/kafbat/ui/controller/AuthenticationController.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.kafbat.ui.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.core.io.ClassPathResource; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import reactor.core.publisher.Mono; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class AuthenticationController { | ||
|
||
private static final String INDEX_HTML = "/static/index.html"; | ||
|
||
@GetMapping(value = "/login", produces = {"text/html"}) | ||
public Mono<ClassPathResource> getLoginPage() { | ||
return Mono.just(new ClassPathResource(INDEX_HTML)); | ||
} | ||
|
||
} |
This file contains 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
Oops, something went wrong.