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:
parent
508a5e414b
commit
cd2e805d91
@ -1,6 +1,5 @@
|
|||||||
package com.baeldung.javaee.security;
|
package com.baeldung.javaee.security;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.annotation.HttpConstraint;
|
import javax.servlet.annotation.HttpConstraint;
|
||||||
import javax.servlet.annotation.ServletSecurity;
|
import javax.servlet.annotation.ServletSecurity;
|
||||||
import javax.servlet.annotation.WebServlet;
|
import javax.servlet.annotation.WebServlet;
|
||||||
@ -14,7 +13,7 @@ import java.io.IOException;
|
|||||||
public class AdminServlet extends HttpServlet {
|
public class AdminServlet extends HttpServlet {
|
||||||
|
|
||||||
@Override
|
@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 :" + request.getUserPrincipal().getName() + "\n");
|
||||||
response.getWriter().append("User in Role user_role :" + request.isUserInRole("user_role") + "\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"));
|
response.getWriter().append("User in Role admin_role :" + request.isUserInRole("admin_role"));
|
||||||
|
@ -2,7 +2,6 @@ package com.baeldung.javaee.security;
|
|||||||
|
|
||||||
import javax.enterprise.context.ApplicationScoped;
|
import javax.enterprise.context.ApplicationScoped;
|
||||||
import javax.security.enterprise.authentication.mechanism.http.BasicAuthenticationMechanismDefinition;
|
import javax.security.enterprise.authentication.mechanism.http.BasicAuthenticationMechanismDefinition;
|
||||||
import javax.security.enterprise.authentication.mechanism.http.CustomFormAuthenticationMechanismDefinition;
|
|
||||||
import javax.security.enterprise.identitystore.DatabaseIdentityStoreDefinition;
|
import javax.security.enterprise.identitystore.DatabaseIdentityStoreDefinition;
|
||||||
|
|
||||||
@BasicAuthenticationMechanismDefinition(realmName = "defaultRealm")
|
@BasicAuthenticationMechanismDefinition(realmName = "defaultRealm")
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package com.baeldung.javaee.security;
|
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.ServletException;
|
||||||
import javax.servlet.annotation.HttpConstraint;
|
import javax.servlet.annotation.HttpConstraint;
|
||||||
import javax.servlet.annotation.ServletSecurity;
|
import javax.servlet.annotation.ServletSecurity;
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
<feature>webProfile-8.0</feature>
|
<feature>webProfile-8.0</feature>
|
||||||
</featureManager>
|
</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}"
|
<httpEndpoint httpPort="${default.http.port}" httpsPort="${default.https.port}"
|
||||||
id="defaultHttpEndpoint" host="*"/>
|
id="defaultHttpEndpoint" host="*"/>
|
||||||
</server>
|
</server>
|
||||||
|
@ -31,32 +31,31 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<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>
|
<configuration>
|
||||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
<serverName>guideServer</serverName>
|
||||||
<packagingExcludes>pom.xml</packagingExcludes>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>net.wasdev.wlp.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>liberty-maven-plugin</artifactId>
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
<version>${liberty-maven-plugin.version}</version>
|
<version>3.1.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<install>
|
<systemPropertyVariables>
|
||||||
<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>
|
|
||||||
<default.http.port>${defaultHttpPort}</default.http.port>
|
<default.http.port>${defaultHttpPort}</default.http.port>
|
||||||
<default.https.port>${defaultHttpsPort}</default.https.port>
|
<http.port>${defaultHttpPort}</http.port>
|
||||||
</bootstrapProperties>
|
<war.name>${liberty.var.app.context.root}</war.name>
|
||||||
|
</systemPropertyVariables>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
@ -65,9 +64,10 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<defaultHttpPort>9080</defaultHttpPort>
|
<defaultHttpPort>9080</defaultHttpPort>
|
||||||
<defaultHttpsPort>9443</defaultHttpsPort>
|
<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>
|
<liberty-maven-plugin.version>2.3</liberty-maven-plugin.version>
|
||||||
<openliberty-runtime.version>18.0.0.1</openliberty-runtime.version>
|
<openliberty-runtime.version>18.0.0.1</openliberty-runtime.version>
|
||||||
|
<liberty.var.app.context.root>${project.artifactId}</liberty.var.app.context.root>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -17,7 +17,7 @@
|
|||||||
<module>apache-shiro</module>
|
<module>apache-shiro</module>
|
||||||
<module>cas</module>
|
<module>cas</module>
|
||||||
<module>cloud-foundry-uaa</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>jee-7-security</module>
|
||||||
<module>jjwt</module>
|
<module>jjwt</module>
|
||||||
<module>jwt</module>
|
<module>jwt</module>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user