[OPDS] Fix search option not recognized by MoonReader (#565)
This commit is contained in:
+11
-2
@@ -56,6 +56,10 @@ public class SecurityConfig {
|
|||||||
"/api/v1/pdf/*/pages/*"
|
"/api/v1/pdf/*/pages/*"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static final String[] COMMON_UNAUTHENTICATED_ENDPOINTS = {
|
||||||
|
"/api/v1/opds/search.opds"
|
||||||
|
};
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PasswordEncoder passwordEncoder() {
|
public PasswordEncoder passwordEncoder() {
|
||||||
return new BCryptPasswordEncoder();
|
return new BCryptPasswordEncoder();
|
||||||
@@ -64,11 +68,16 @@ public class SecurityConfig {
|
|||||||
@Bean
|
@Bean
|
||||||
@Order(1)
|
@Order(1)
|
||||||
public SecurityFilterChain opdsBasicAuthSecurityChain(HttpSecurity http) throws Exception {
|
public SecurityFilterChain opdsBasicAuthSecurityChain(HttpSecurity http) throws Exception {
|
||||||
|
|
||||||
|
List<String> unauthenticatedEndpoints = new ArrayList<>(Arrays.asList(COMMON_UNAUTHENTICATED_ENDPOINTS));
|
||||||
http
|
http
|
||||||
.securityMatcher("/api/v1/opds/**")
|
.securityMatcher("/api/v1/opds/**")
|
||||||
.csrf(AbstractHttpConfigurer::disable)
|
.csrf(AbstractHttpConfigurer::disable)
|
||||||
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||||
.authorizeHttpRequests(auth -> auth.anyRequest().authenticated())
|
.authorizeHttpRequests(auth -> auth
|
||||||
|
.requestMatchers(unauthenticatedEndpoints.toArray(new String[0])).permitAll()
|
||||||
|
.anyRequest().authenticated()
|
||||||
|
)
|
||||||
.httpBasic(basic -> basic
|
.httpBasic(basic -> basic
|
||||||
.realmName("Booklore OPDS")
|
.realmName("Booklore OPDS")
|
||||||
.authenticationEntryPoint((request, response, authException) -> {
|
.authenticationEntryPoint((request, response, authException) -> {
|
||||||
@@ -129,4 +138,4 @@ public class SecurityConfig {
|
|||||||
|
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user