Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-autograde
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CS-107
moodle-autograde
Commits
e0620e33
Unverified
Commit
e0620e33
authored
6 months ago
by
Hamza Remmal
Browse files
Options
Downloads
Patches
Plain Diff
chore: disable LDAP auth for now
parent
1818fa45
No related branches found
No related tags found
1 merge request
!277
chore: finally, a fully working shared secret authentication chain :-)
Pipeline
#224261
passed
6 months ago
Stage: prepare-pipeline
Stage: build
Stage: test
Stage: coverage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
autograde-service/pom.xml
+3
-2
3 additions, 2 deletions
autograde-service/pom.xml
autograde-service/src/main/java/ch/epfl/autograde/config/SecurityConfig.java
+7
-13
7 additions, 13 deletions
...rc/main/java/ch/epfl/autograde/config/SecurityConfig.java
with
10 additions
and
15 deletions
autograde-service/pom.xml
+
3
−
2
View file @
e0620e33
...
@@ -57,7 +57,8 @@
...
@@ -57,7 +57,8 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
</dependency>
<dependency>
<!-- TODO: UNCOMMENT THIS TO ENABLE THE LDAP AUTH
<dependency>
<groupId>org.springframework.ldap</groupId>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<artifactId>spring-ldap-core</artifactId>
</dependency>
</dependency>
...
@@ -65,7 +66,7 @@
...
@@ -65,7 +66,7 @@
<groupId>org.springframework.security</groupId>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<artifactId>spring-security-ldap</artifactId>
</dependency>
</dependency>
-->
</dependencies>
</dependencies>
<build>
<build>
...
...
This diff is collapsed.
Click to expand it.
autograde-service/src/main/java/ch/epfl/autograde/config/SecurityConfig.java
+
7
−
13
View file @
e0620e33
...
@@ -3,26 +3,15 @@ package ch.epfl.autograde.config;
...
@@ -3,26 +3,15 @@ package ch.epfl.autograde.config;
import
ch.epfl.autograde.auth.token.ShareSecretAuthenticationProvider
;
import
ch.epfl.autograde.auth.token.ShareSecretAuthenticationProvider
;
import
ch.epfl.autograde.auth.token.SharedSecretConfigurer
;
import
ch.epfl.autograde.auth.token.SharedSecretConfigurer
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.ldap.core.support.BaseLdapPathContextSource
;
import
org.springframework.security.authentication.AuthenticationManager
;
import
org.springframework.security.authentication.ProviderManager
;
import
org.springframework.security.authentication.ProviderManager
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
;
import
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
;
import
org.springframework.security.config.annotation.web.configurers.RequestCacheConfigurer
;
import
org.springframework.security.config.annotation.web.configurers.RequestCacheConfigurer
;
import
org.springframework.security.config.ldap.LdapBindAuthenticationManagerFactory
;
import
org.springframework.security.ldap.DefaultSpringSecurityContextSource
;
import
org.springframework.security.web.SecurityFilterChain
;
import
org.springframework.security.web.SecurityFilterChain
;
import
org.springframework.security.web.servlet.util.matcher.MvcRequestMatcher
;
import
org.springframework.security.web.util.matcher.NegatedRequestMatcher
;
import
org.springframework.web.servlet.handler.HandlerMappingIntrospector
;
import
static
org
.
springframework
.
security
.
config
.
Customizer
.
withDefaults
;
/**
/**
* Security configuration and setup of the autograde service.
* Security configuration and setup of the autograde service.
...
@@ -44,7 +33,7 @@ public class SecurityConfig {
...
@@ -44,7 +33,7 @@ public class SecurityConfig {
@Bean
@Bean
@Order
(
1
)
@Order
(
1
)
public
SecurityFilterChain
filterChain
(
HttpSecurity
http
,
ShareSecretAuthenticationProvider
provider
)
throws
Exception
{
public
SecurityFilterChain
filterChain
(
HttpSecurity
http
,
ShareSecretAuthenticationProvider
provider
)
throws
Exception
{
http
.
apply
(
new
SharedSecretConfigurer
());
http
.
apply
(
new
SharedSecretConfigurer
<>
());
return
http
return
http
.
securityMatcher
(
"/api/**"
)
.
securityMatcher
(
"/api/**"
)
.
authenticationManager
(
new
ProviderManager
(
provider
))
.
authenticationManager
(
new
ProviderManager
(
provider
))
...
@@ -77,10 +66,14 @@ public class SecurityConfig {
...
@@ -77,10 +66,14 @@ public class SecurityConfig {
.
httpBasic
(
AbstractHttpConfigurer:
:
disable
)
.
httpBasic
(
AbstractHttpConfigurer:
:
disable
)
.
formLogin
(
AbstractHttpConfigurer:
:
disable
)
.
formLogin
(
AbstractHttpConfigurer:
:
disable
)
.
sessionManagement
(
AbstractHttpConfigurer:
:
disable
)
.
sessionManagement
(
AbstractHttpConfigurer:
:
disable
)
.
authorizeHttpRequests
(
auth
->
auth
.
anyRequest
().
permitAll
())
.
authorizeHttpRequests
(
auth
->
{
auth
.
requestMatchers
(
"/actuator/heath"
).
permitAll
();
auth
.
anyRequest
().
authenticated
();
})
.
build
();
.
build
();
}
}
/* TODO: UNCOMMENT THIS TO ENABLE THE LDAP AUTH
@Bean
@Bean
@Order(Ordered.LOWEST_PRECEDENCE)
@Order(Ordered.LOWEST_PRECEDENCE)
public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http, @Qualifier("ldapAuthenticationManager") AuthenticationManager manager, HandlerMappingIntrospector introspector) throws Exception {
public SecurityFilterChain defaultSecurityFilterChain(HttpSecurity http, @Qualifier("ldapAuthenticationManager") AuthenticationManager manager, HandlerMappingIntrospector introspector) throws Exception {
...
@@ -120,6 +113,7 @@ public class SecurityConfig {
...
@@ -120,6 +113,7 @@ public class SecurityConfig {
public BaseLdapPathContextSource contextSource() {
public BaseLdapPathContextSource contextSource() {
return new DefaultSpringSecurityContextSource("ldaps://ldap.epfl.ch");
return new DefaultSpringSecurityContextSource("ldaps://ldap.epfl.ch");
}
}
*/
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment