-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from agorapulse/bug/fix-micronaut-security-ena…
…bled-false skip using MicronautSecurityUserArgumentBinder when micronaut.security.enabled is set to false
- Loading branch information
Showing
80 changed files
with
189 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/micronaut-console-example-application/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/micronaut-console-example-application/micronaut-console-example-application.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...naut-console-example-application/src/main/java/micronaut/console/example/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...plication/src/main/java/micronaut/console/example/AuthenticationProviderUserPassword.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ole-example-application/src/main/java/micronaut/console/example/SimpleAuthentication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ple-application/src/main/java/micronaut/console/example/SimpleAuthenticationResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
examples/micronaut-console-example-application/src/main/resources/application-secured.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# tag::micronaut-security[] | ||
micronaut: | ||
security: | ||
enabled: true # <1> | ||
endpoints: | ||
login: | ||
enabled: true # <2> | ||
token: | ||
jwt: | ||
enabled: true # <3> | ||
signatures: | ||
secret: | ||
generator: | ||
secret: pleaseChangeThisSecretForANewOne # <4> | ||
intercept-url-map: | ||
- pattern: /console/** # <5> | ||
http-method: GET | ||
access: | ||
- isAnonymous() | ||
- pattern: /console/** # <6> | ||
http-method: POST | ||
access: | ||
- isAuthenticated() | ||
# end::micronaut-security[] | ||
console: | ||
# tag::users[] | ||
users: | ||
- sherlock | ||
# end::users[] | ||
# tag::address[] | ||
addresses: | ||
- /127.0.0.1 | ||
- /0:0:0:0:0:0:0:1 | ||
# end::address[] | ||
until: 2030-11-12T10:28:00Z |
39 changes: 3 additions & 36 deletions
39
examples/micronaut-console-example-application/src/main/resources/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,6 @@ | ||
micronaut: | ||
application: | ||
name: micronaut-console-example | ||
--- | ||
# tag::micronaut-security[] | ||
micronaut: | ||
security: | ||
enabled: true # <1> | ||
endpoints: | ||
login: | ||
enabled: true # <2> | ||
token: | ||
jwt: | ||
enabled: true # <3> | ||
signatures: | ||
secret: | ||
generator: | ||
secret: pleaseChangeThisSecretForANewOne # <4> | ||
intercept-url-map: | ||
- pattern: /console/** # <5> | ||
http-method: GET | ||
access: | ||
- isAnonymous() | ||
- pattern: /console/** # <6> | ||
http-method: POST | ||
access: | ||
- isAuthenticated() | ||
# end::micronaut-security[] | ||
enabled: false | ||
|
||
console: | ||
# tag::users[] | ||
users: | ||
- sherlock | ||
# end::users[] | ||
# tag::address[] | ||
addresses: | ||
- /127.0.0.1 | ||
- /0:0:0:0:0:0:0:1 | ||
# end::address[] | ||
until: 2030-11-12T10:28:00Z | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...src/test/groovy/micronaut/console/example/MicronautSecurityDisabledIntegrationSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Copyright 2020-2022 Agorapulse. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package micronaut.console.example | ||
|
||
import com.agorapulse.gru.Gru | ||
import com.agorapulse.gru.http.Http | ||
import io.micronaut.context.ApplicationContext | ||
import io.micronaut.runtime.server.EmbeddedServer | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
|
||
class MicronautSecurityDisabledIntegrationSpec extends Specification { | ||
|
||
@Shared @AutoCleanup ApplicationContext context | ||
@Shared @AutoCleanup EmbeddedServer server | ||
|
||
@AutoCleanup Gru gru = Gru.create(Http.create(this)) | ||
|
||
void setupSpec() { | ||
context = ApplicationContext.builder().build() | ||
|
||
context.start() | ||
|
||
server = context.getBean(EmbeddedServer) | ||
server.start() | ||
} | ||
|
||
void setup() { | ||
gru.prepare(server.URL.toString()) | ||
} | ||
|
||
void 'can access the console when micronaut.security.enabled is set to false'() { | ||
expect: | ||
gru.test { | ||
post '/console/execute/result', { | ||
content inline('"Hello World"'), 'text/groovy' | ||
} | ||
expect { | ||
text inline('Hello World') | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/micronaut-console-example-kotlin/micronaut-console-example-kotlin.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ut-console-example-kotlin/src/main/kotlin/micronaut/console/example/kotlin/Application.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
libs/micronaut-console/src/main/groovy/com/agorapulse/micronaut/console/AuditService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
libs/micronaut-console/src/main/groovy/com/agorapulse/micronaut/console/BindingProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ronaut-console/src/main/groovy/com/agorapulse/micronaut/console/ConsoleConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.