-
-
Notifications
You must be signed in to change notification settings - Fork 155
BE: Impl custom authentication page #635
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
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
25dea60
Misc
Haarolean 1e668f8
Impl authentication page backend
Haarolean 7b6cf2e
Merge remote-tracking branch 'origin/main' into auth_page_be
Haarolean d91e8b9
Add POST auth endpoint
Haarolean 5ec0abe
Merge branch 'main' into auth_page_be
Haarolean 38142b9
Fixed login page renderer
germanosin 3cfd738
Polish
Haarolean 10f0b8f
Apply filter for all configs
Haarolean 00af933
Change login URL and fix basic auth
Haarolean bba68eb
Fix LDAP, refactor
Haarolean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 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
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 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
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
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
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
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 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
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 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.