JAVA-23118 Fix java-ee-8-security-api module (#14397)

* JAVA-23118 Fix java-ee-8-security-api module

* JAVA-23118 Additional changes

---------

Co-authored-by: timis1 <noreplay@yahoo.com>
This commit is contained in:
timis1 2023-07-20 16:59:57 +03:00 committed by GitHub
parent 508a5e414b
commit cd2e805d91
6 changed files with 24 additions and 25 deletions

View File

@ -1,6 +1,5 @@
package com.baeldung.javaee.security;
import javax.servlet.ServletException;
import javax.servlet.annotation.HttpConstraint;
import javax.servlet.annotation.ServletSecurity;
import javax.servlet.annotation.WebServlet;
@ -14,7 +13,7 @@ import java.io.IOException;
public class AdminServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.getWriter().append("User :" + request.getUserPrincipal().getName() + "\n");
response.getWriter().append("User in Role user_role :" + request.isUserInRole("user_role") + "\n");
response.getWriter().append("User in Role admin_role :" + request.isUserInRole("admin_role"));

View File

@ -2,7 +2,6 @@ package com.baeldung.javaee.security;
import javax.enterprise.context.ApplicationScoped;
import javax.security.enterprise.authentication.mechanism.http.BasicAuthenticationMechanismDefinition;
import javax.security.enterprise.authentication.mechanism.http.CustomFormAuthenticationMechanismDefinition;
import javax.security.enterprise.identitystore.DatabaseIdentityStoreDefinition;
@BasicAuthenticationMechanismDefinition(realmName = "defaultRealm")

View File

@ -1,8 +1,5 @@
package com.baeldung.javaee.security;
import javax.annotation.security.DeclareRoles;
import javax.inject.Inject;
import javax.security.enterprise.SecurityContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.HttpConstraint;
import javax.servlet.annotation.ServletSecurity;

View File

@ -4,6 +4,10 @@
<feature>webProfile-8.0</feature>
</featureManager>
<variable name="default.http.port" defaultValue="9080"/>
<variable name="default.https.port" defaultValue="9443"/>
<variable name="app.context.root" defaultValue="/"/>
<httpEndpoint httpPort="${default.http.port}" httpsPort="${default.https.port}"
id="defaultHttpEndpoint" host="*"/>
</server>

View File

@ -31,32 +31,31 @@
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.8.2</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>pom.xml</packagingExcludes>
<serverName>guideServer</serverName>
</configuration>
</plugin>
<plugin>
<groupId>net.wasdev.wlp.maven.plugins</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>${liberty-maven-plugin.version}</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<install>
<runtimeUrl>
https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/release/2018-09-05_2337/openliberty-18.0.0.3.zip
</runtimeUrl>
</install>
<looseApplication>true</looseApplication>
<installAppPackages>project</installAppPackages>
<configFile>src/main/liberty/config/server.xml</configFile>
<stripVersion>true</stripVersion>
<bootstrapProperties>
<systemPropertyVariables>
<default.http.port>${defaultHttpPort}</default.http.port>
<default.https.port>${defaultHttpsPort}</default.https.port>
</bootstrapProperties>
<http.port>${defaultHttpPort}</http.port>
<war.name>${liberty.var.app.context.root}</war.name>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
@ -65,9 +64,10 @@
<properties>
<defaultHttpPort>9080</defaultHttpPort>
<defaultHttpsPort>9443</defaultHttpsPort>
<javaee-version>8.0</javaee-version>
<javaee-version>8.0.1</javaee-version>
<liberty-maven-plugin.version>2.3</liberty-maven-plugin.version>
<openliberty-runtime.version>18.0.0.1</openliberty-runtime.version>
<liberty.var.app.context.root>${project.artifactId}</liberty.var.app.context.root>
</properties>
</project>

View File

@ -17,7 +17,7 @@
<module>apache-shiro</module>
<module>cas</module>
<module>cloud-foundry-uaa</module>
<!-- <module>java-ee-8-security-api</module> --> <!-- Fixing in JAVA-23118 -->
<module>java-ee-8-security-api</module>
<module>jee-7-security</module>
<module>jjwt</module>
<module>jwt</module>