Skip to content

Commit

Permalink
Add SecurityConfig to project
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb Carlson committed Dec 3, 2021
1 parent fe31153 commit 7403f95
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ dependencies {
implementation group: 'org.mongodb', name: 'bson', version: '4.3.3'

// For Spring Boot
implementation 'org.springframework.boot:spring-boot-starter-web:2.5.5'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.5'
implementation 'org.springframework.boot:spring-boot-starter-web:2.5.6'
implementation 'org.springframework.security:spring-security-core:5.5.1'
implementation 'org.springframework.boot:spring-boot-starter-security'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.6'

// For MATLAB on Mac
//implementation files('/Applications/MATLAB_R2021a.app/java/jar/engine.jar')
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/org/sustain/security/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.sustain.security;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
public class SecurityConfig {

@Bean
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http
.requiresChannel(channel ->
channel.anyRequest().requiresSecure())
.authorizeRequests(authorize ->
authorize.anyRequest().permitAll())
.build();
}

}

0 comments on commit 7403f95

Please sign in to comment.