diff options
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(); + } |