-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): Support running with
management.security.enabled: false
(#…
…232) This PR re-orders how the `FiatAuthenticationFilter` is inserted into the http chain. Previously when management security was disabled, the caller was redirected to `/login`. - introduce a metric to track how often the unregistered user fallback is hit - support dynamically disabling the permission evaluator
- Loading branch information
Showing
7 changed files
with
75 additions
and
27 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ package com.netflix.spinnaker.fiat.controllers | |
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
import com.netflix.hystrix.strategy.HystrixPlugins | ||
import com.netflix.spectator.api.NoopRegistry | ||
import com.netflix.spectator.api.Registry | ||
import com.netflix.spinnaker.config.FiatSystemTest | ||
import com.netflix.spinnaker.config.TestUserRoleProviderConfig | ||
import com.netflix.spinnaker.fiat.config.FiatServerConfigurationProperties | ||
|
@@ -33,6 +35,7 @@ import org.springframework.test.web.servlet.MockMvc | |
import org.springframework.test.web.servlet.setup.MockMvcBuilders | ||
import org.springframework.web.context.WebApplicationContext | ||
import spock.lang.AutoCleanup | ||
import spock.lang.Shared | ||
import spock.lang.Specification | ||
import spock.lang.Unroll | ||
|
||
|
@@ -42,6 +45,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. | |
|
||
@FiatSystemTest | ||
class AuthorizeControllerSpec extends Specification { | ||
@Shared | ||
Registry registry = new NoopRegistry() | ||
|
||
@Autowired | ||
WebApplicationContext wac | ||
|
@@ -146,7 +151,7 @@ class AuthorizeControllerSpec extends Specification { | |
def "should get user from repo"() { | ||
setup: | ||
PermissionsRepository repository = Mock(PermissionsRepository) | ||
AuthorizeController controller = new AuthorizeController(repository, fiatServerConfigurationProperties) | ||
AuthorizeController controller = new AuthorizeController(registry, repository, fiatServerConfigurationProperties) | ||
|
||
def foo = new UserPermission().setId("[email protected]") | ||
|
||
|
@@ -168,7 +173,7 @@ class AuthorizeControllerSpec extends Specification { | |
def "should get user's accounts from repo"() { | ||
setup: | ||
PermissionsRepository repository = Mock(PermissionsRepository) | ||
AuthorizeController controller = new AuthorizeController(repository, fiatServerConfigurationProperties) | ||
AuthorizeController controller = new AuthorizeController(registry, repository, fiatServerConfigurationProperties) | ||
|
||
def bar = new Account().setName("bar") | ||
def foo = new UserPermission().setId("foo").setAccounts([bar] as Set) | ||
|
@@ -243,6 +248,7 @@ class AuthorizeControllerSpec extends Specification { | |
def "should fallback to unrestricted user if no session available"() { | ||
given: | ||
def authorizeController = new AuthorizeController( | ||
registry, | ||
permissionsRepository, | ||
new FiatServerConfigurationProperties(defaultToUnrestrictedUser: defaultToUnrestrictedUser) | ||
) | ||
|