spring-projects / spring-projects/spring-security

SEC-2887: Add secure(true) to FormLoginRequestBuilder

Open
#3,104 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement type: jira
Dominant language
Java
Stars
9.6k
Forks
6.3k
Avg merge
2d 11h
Merged PRs (30d)
52

Description

Petar Tahchiev (Migrated from SEC-2887) said:

Hello,

my spring security configuration requres that /j_spring_security_check is invoked over HTTPS. So my tests:

      mockMvc.perform(formLogin("/j_spring_security_check").user("pe6o").password("1234")).andExpect(status().isFound()).andExpect(
                        redirectedUrl("/my-account")).andExpect(authenticated());

fails with:

  LoginPageControllerIntegrationTest.testLoginWithValidCredentials:60 Redirected URL expected:</my-account> but was:<https://localhost/j_spring_security_check>

It is redirecting me to HTTPS and I cannot set .secure(true) on the form request.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate FormLoginRequestBuilder and its formLogin entry point; inspect how the request is built and how other request options are exposed. Verify that formLogin(...).secure(true) can exercise an HTTPS-only configuration without redirecting to HTTPS, using the configuration and failing behavior described in the issue as the completion check.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
security, testing
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.