-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5041cb
commit 0247975
Showing
20 changed files
with
49 additions
and
103 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
Binary file not shown.
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,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
65 changes: 3 additions & 62 deletions
65
src/main/kotlin/com/xmppjingle/bjomeliga/config/SecurityConfig.kt
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,72 +1,13 @@ | ||
package com.xmppjingle.bjomeliga.config | ||
|
||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.http.HttpMethod | ||
import org.springframework.security.authentication.AuthenticationManager | ||
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity | ||
import org.springframework.security.config.annotation.web.builders.WebSecurity | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter | ||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter | ||
import org.springframework.stereotype.Component | ||
import springfox.documentation.builders.PathSelectors | ||
import springfox.documentation.builders.RequestHandlerSelectors | ||
import springfox.documentation.spi.DocumentationType | ||
import springfox.documentation.spring.web.plugins.Docket | ||
|
||
|
||
@Configuration | ||
@EnableWebSecurity | ||
@EnableGlobalMethodSecurity(prePostEnabled = true) | ||
@Component | ||
internal class SecurityConfig : WebSecurityConfigurerAdapter() { | ||
|
||
private lateinit var apiKeyAuthFilter: ApiKeyAuthFilter | ||
|
||
@Throws(Exception::class) | ||
override fun configure(web: WebSecurity) { | ||
web.ignoring().antMatchers(HttpMethod.OPTIONS).antMatchers(*AUTH_WHITELIST) | ||
} | ||
|
||
private val AUTH_WHITELIST = arrayOf( | ||
"/v2/**", | ||
"/configuration/**", | ||
"/swagger-resources/**", | ||
"/configuration/security", | ||
"/swagger-ui.html", | ||
"/swagger-ui/**", | ||
"/webjars/**", | ||
"/drawer/**", | ||
"/events/**", | ||
"/config/**", | ||
"/experiment/**" | ||
) | ||
|
||
@Throws(java.lang.Exception::class) | ||
override fun configure(http: HttpSecurity) { | ||
apiKeyAuthFilter = ApiKeyAuthFilter(authenticationManager()) | ||
http.addFilterBefore(apiKeyAuthFilter, UsernamePasswordAuthenticationFilter::class.java) | ||
.authorizeRequests() | ||
// Whitelisted endpoints that do not require authentication | ||
.antMatchers(*AUTH_WHITELIST).permitAll() | ||
// Endpoints that require authentication | ||
.antMatchers("/**/*").authenticated() | ||
.antMatchers("/**/*").denyAll() | ||
} | ||
|
||
@Bean | ||
fun api(): Docket? { | ||
return Docket(DocumentationType.SWAGGER_2) | ||
.select() | ||
.apis(RequestHandlerSelectors.any()) | ||
.paths(PathSelectors.any()) | ||
.build() | ||
} | ||
class SecurityConfig { | ||
|
||
@Bean | ||
override fun authenticationManagerBean(): AuthenticationManager { | ||
return super.authenticationManagerBean() | ||
} | ||
} | ||
} |
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
1 change: 0 additions & 1 deletion
1
src/main/kotlin/com/xmppjingle/bjomeliga/service/DrawerService.kt
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
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/com/xmppjingle/bjomeliga/service/RecommendationService.kt
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
1 change: 0 additions & 1 deletion
1
src/main/kotlin/com/xmppjingle/bjomeliga/service/SummariesService.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
redis.url:redis://localhost:6333 |
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