diff options
author | Thomas <> | 2023-05-11 12:34:27 +0200 |
---|---|---|
committer | Thomas <> | 2023-05-11 12:34:27 +0200 |
commit | 13da938658e0f799a7c89faadcfbbfee95a220d8 (patch) | |
tree | bbe38aa00660f760e3d7c19b756f790e1f673e30 /eaaf-springboot-utils/src/main/java | |
parent | 342ec1478cb6f15deb1f359d429f521bac5f04c8 (diff) | |
download | EAAF-Components-13da938658e0f799a7c89faadcfbbfee95a220d8.tar.gz EAAF-Components-13da938658e0f799a7c89faadcfbbfee95a220d8.tar.bz2 EAAF-Components-13da938658e0f799a7c89faadcfbbfee95a220d8.zip |
feat(spring): add authorisation configuration for multi-modul projects
Diffstat (limited to 'eaaf-springboot-utils/src/main/java')
-rw-r--r-- | eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/AuthorizationConfiguration.java | 40 | ||||
-rw-r--r-- | eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/IBasicAuthSecurityCollector.java (renamed from eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/IBasicAuthUserCollector.java) | 10 |
2 files changed, 49 insertions, 1 deletions
diff --git a/eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/AuthorizationConfiguration.java b/eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/AuthorizationConfiguration.java new file mode 100644 index 00000000..b62d4761 --- /dev/null +++ b/eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/AuthorizationConfiguration.java @@ -0,0 +1,40 @@ +package at.gv.egiz.eaaf.utils.springboot.security; + +import java.util.List; + +import lombok.Builder; +import lombok.Getter; +import lombok.Singular; + +/** + * Configuration holder for Spring Security end-point authorization. + * + * @author tlenz + * + */ +@Builder +@Getter +public class AuthorizationConfiguration { + + /** + * Role String that is required for that end-points. + */ + private final String role; + + /** + * List of end-points. + */ + @Singular + private List<String> endpoints; + + /** + * List of end-points as Java Array. + * + * @return end-points. + */ + public String[] getEndPointsArray() { + return endpoints.stream().toArray(String[]::new); + + } + +} diff --git a/eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/IBasicAuthUserCollector.java b/eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/IBasicAuthSecurityCollector.java index 1986d52b..2bf65af7 100644 --- a/eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/IBasicAuthUserCollector.java +++ b/eaaf-springboot-utils/src/main/java/at/gv/egiz/eaaf/utils/springboot/security/IBasicAuthSecurityCollector.java @@ -11,7 +11,7 @@ import javax.annotation.Nonnull; * @author tlenz * */ -public interface IBasicAuthUserCollector { +public interface IBasicAuthSecurityCollector { /** * Get all users that shall be added for Spring Security Basic-Auth. @@ -21,4 +21,12 @@ public interface IBasicAuthUserCollector { @Nonnull List<BasicAuthUser> getEnabledUsers(); + /** + * Get end-point security configuration for Spring Security antMatchers. + * + * @return List of end-point security configuration-elements + */ + @Nonnull + List<AuthorizationConfiguration> getAntMatchersConfiguration(); + } |