eclipse-ee4j / eclipse-ee4j/soteria

App-mem-custom-form securityContext looping

Open
#202 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
72
Forks
34
PR merge metrics
No merged PRs in 30d

Description

I am trying to implement the loginbacking according to the App-mem-custom-form and when I run:

```
@Inject
SecurityContext securityContext;

FacesContext context = FacesContext.getCurrentInstance();
Credential credential = new UsernamePasswordCredential(username, new Password(password));

AuthenticationStatus status = securityContext.authenticate(
getRequest(context),
getResponse(context),
withParams()
.credential(credential));

private static HttpServletResponse getResponse(FacesContext context) {
return (HttpServletResponse) context
.getExternalContext()
.getResponse();
}

private static HttpServletRequest getRequest(FacesContext context) {
return (HttpServletRequest) context
.getExternalContext()
.getRequest();
}
```

Instead of returning status(NOT_DONE, SEND_CONTINUE, SUCCESS, or SEND_FAILURE) it loops back and runs securityContext.authenticate infinitely.
I have tried with both:

```
import javax.security.enterprise.SecurityContext;
import org.glassfish.soteria.SecurityContextImpl;
```

and I get the same looping issue with both.
Hopefully just a maven dependancy issue on my part but I thought i'd check if anyone else was having this issue.

[pom.txt](https://github.com/javaee/security-soteria/files/1582950/pom.txt)

Contributor guide

Open the contributing guide

Research direction

Start with the linked pom.txt and the App-mem-custom-form configuration, then trace the SecurityContext.authenticate call shown in the issue. Reproduce the login flow and determine why it re-enters authenticate instead of returning an AuthenticationStatus; done means the flow returns one of the documented statuses without looping.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authentication, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.