You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ra...@apache.org on 2019/01/09 17:26:29 UTC
[tomee] 41/48: TOMEE-2365 - AutoApplySession to FormAuthentication
to keep session.
This is an automated email from the ASF dual-hosted git repository.
radcortez pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 99318c82e346f4cbc4c8467f7fd140dfaf88c5c5
Author: Roberto Cortez <ra...@yahoo.com>
AuthorDate: Mon Jan 7 17:05:26 2019 +0000
TOMEE-2365 - AutoApplySession to FormAuthentication to keep session.
---
.../java/org/apache/tomee/security/cdi/FormAuthenticationMechanism.java | 2 ++
.../java/org/apache/tomee/security/servlet/FormAuthServletTest.java | 2 ++
2 files changed, 4 insertions(+)
diff --git a/tomee/tomee-security/src/main/java/org/apache/tomee/security/cdi/FormAuthenticationMechanism.java b/tomee/tomee-security/src/main/java/org/apache/tomee/security/cdi/FormAuthenticationMechanism.java
index 08f482b..1bdd60f 100644
--- a/tomee/tomee-security/src/main/java/org/apache/tomee/security/cdi/FormAuthenticationMechanism.java
+++ b/tomee/tomee-security/src/main/java/org/apache/tomee/security/cdi/FormAuthenticationMechanism.java
@@ -22,6 +22,7 @@ import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.security.enterprise.AuthenticationException;
import javax.security.enterprise.AuthenticationStatus;
+import javax.security.enterprise.authentication.mechanism.http.AutoApplySession;
import javax.security.enterprise.authentication.mechanism.http.HttpAuthenticationMechanism;
import javax.security.enterprise.authentication.mechanism.http.HttpMessageContext;
import javax.security.enterprise.authentication.mechanism.http.LoginToContinue;
@@ -33,6 +34,7 @@ import javax.ws.rs.HttpMethod;
import java.util.function.Supplier;
@ApplicationScoped
+@AutoApplySession
@LoginToContinue
public class FormAuthenticationMechanism implements HttpAuthenticationMechanism, LoginToContinueMechanism {
@Inject
diff --git a/tomee/tomee-security/src/test/java/org/apache/tomee/security/servlet/FormAuthServletTest.java b/tomee/tomee-security/src/test/java/org/apache/tomee/security/servlet/FormAuthServletTest.java
index 4a8ccf7..1fd6f7e 100644
--- a/tomee/tomee-security/src/test/java/org/apache/tomee/security/servlet/FormAuthServletTest.java
+++ b/tomee/tomee-security/src/test/java/org/apache/tomee/security/servlet/FormAuthServletTest.java
@@ -50,6 +50,8 @@ public class FormAuthServletTest extends AbstractTomEESecurityTest {
final Page result = login.getInputByName("submit").click();
assertEquals(200, result.getWebResponse().getStatusCode());
assertEquals("ok!", result.getWebResponse().getContentAsString());
+
+ assertEquals("ok!", webClient.getPage(getAppUrl() + "/form").getWebResponse().getContentAsString());
}
@ApplicationScoped