Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST Assured-Test with Basic Auth fails since 0.24.0 #4638

Closed
wicksim opened this issue Oct 17, 2019 · 6 comments
Closed

REST Assured-Test with Basic Auth fails since 0.24.0 #4638

wicksim opened this issue Oct 17, 2019 · 6 comments
Labels
kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant

Comments

@wicksim
Copy link

wicksim commented Oct 17, 2019

Describe the bug
I've a test, which uses REST Assured to test an REST-endpoint. This endpoint is secured with a @RolesAllowed-annotation. In production, we use MP-JWT, in test-environment the Basic-Auth-Mechanism quarkus.security.file is used. Since 0.24.0, i get an HTTP-Status-Code 403 instead of 200. Last working version is 0.23.2.

given()
.auth().preemptive().basic("test", "pass")
.when()
.body(new Order(1, 5))
.contentType(ContentType.JSON)
.put("/order")
.then()
.statusCode(200);

Expected behavior
Returned HTTP-Status-Code is 200.

Actual behavior
Returned HTTP-Status-Code is 403.

To Reproduce
Steps to reproduce the behavior:

  1. Use first steps example
  2. Add @RolesAllowed-annotation to REST-method
  3. Add quarkus-elytron-security-Dependency
  4. Configure application.properties, test-users.properties and test-roles.properties
  5. Modify given test-code: add .auth().preemptive().basic("test", "pass")

Configuration

quarkus.smallrye-jwt.enabled=false
quarkus.security.file.enabled=true
quarkus.security.file.users=test-users.properties
quarkus.security.file.roles=test-roles.properties
quarkus.security.file.auth-mechanism=BASIC

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver: Microsoft Windows [Version 10.0.17763.737]
  • Output of java -version: java version "1.8.0_181"
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 0.24.0/0.25.0 (both not working)

Additional context
(Add any other context about the problem here.)
test-roles.properties

test=customer

test-users.properties

test=pass
@wicksim wicksim added the kind/bug Something isn't working label Oct 17, 2019
@geoand
Copy link
Contributor

geoand commented Oct 17, 2019

@sberyozkin is this something you are aware of perhaps?

@sberyozkin
Copy link
Member

@geoand Not yet, @stuartwdouglas, Stuart, is http security policy setting required to let the requests pass, something along the lines advised for #4544 ?

@stuartwdouglas
Copy link
Member

For 0.25 this needs to be migrated to the new security layer. In particular:

  • You need to depend on elytron-security-properties-file
  • Property names are now: quarkus.security.users.file.* rather than quarkus.security.file.*
  • Basic auth is enabled via quarkus.http.auth.basic=true

@wicksim
Copy link
Author

wicksim commented Oct 21, 2019

It works now, but:

@stuartwdouglas
Copy link
Member

Looks like this was missed in the guides (TBH it does not actually matter at the moment, as BASIC auth is the default if none is explicitly defined).

The old configuration did not really make sense, because you can really use a single auth method, however each Elytron realm had its own property to configure the method. If you configured say one with basic and one with form it was not clear which method would actually be used. The new implementation tries to seperate the method and the identity provider as much as possible.

@wicksim
Copy link
Author

wicksim commented Oct 21, 2019

I'm fine with that...closing the issue.

@wicksim wicksim closed this as completed Oct 21, 2019
@gsmet gsmet added the triage/out-of-date This issue/PR is no longer valid or relevant label Oct 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

No branches or pull requests

5 participants