-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: first code refactor for security
- Loading branch information
Showing
19 changed files
with
152 additions
and
295 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
19 changes: 19 additions & 0 deletions
19
arc-utils/src/main/java/fr/insee/arc/utils/webutils/CheckKeycloak.java
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package fr.insee.arc.utils.webutils; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
|
||
public class CheckKeycloak { | ||
|
||
@Value("${fr.insee.keycloak.realm}") | ||
private String keycloakRealm; | ||
|
||
public boolean isKeycloakActive() | ||
{ | ||
return keycloakRealm!=null; | ||
} | ||
|
||
protected void setKeycloak(String keycloakRealm) { | ||
this.keycloakRealm = keycloakRealm; | ||
} | ||
|
||
} |
13 changes: 6 additions & 7 deletions
13
...e/arc/utils/webutils/WebSecurityTest.java → ...arc/utils/webutils/CheckKeycloakTest.java
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,24 +1,23 @@ | ||
package fr.insee.arc.utils.webutils; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.*; | ||
|
||
import org.junit.Test; | ||
|
||
public class WebSecurityTest { | ||
public class CheckKeycloakTest { | ||
|
||
@Test | ||
public void isKeycloakActiveFalse() | ||
{ | ||
WebSecurity w = new WebSecurity(); | ||
CheckKeycloak w = new CheckKeycloak(); | ||
assertEquals(false, w.isKeycloakActive()); | ||
} | ||
|
||
@Test | ||
public void isKeycloakActiveTrue() | ||
{ | ||
WebSecurity w = new WebSecurity(); | ||
w.setKeycloak("realm", "url", "arc", "credentials"); | ||
CheckKeycloak w = new CheckKeycloak(); | ||
w.setKeycloak("realm"); | ||
assertEquals(true, w.isKeycloakActive()); | ||
} | ||
|
||
} |
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
118 changes: 0 additions & 118 deletions
118
arc-web/src/main/java/fr/insee/arc/web/SecurityConfiguration.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.