Skip to content

Commit

Permalink
Merge pull request #218 from cfieber/master
Browse files Browse the repository at this point in the history
upgrade to latest dependencies
  • Loading branch information
cfieber committed May 12, 2016
2 parents 597c2d1 + 3a0e0d6 commit bd6d60f
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 64 deletions.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ allprojects {
apply plugin: 'groovy'

spinnaker {
dependenciesVersion = "0.23.0"
dependenciesVersion = "0.34.0"
}

configurations.all {
Expand All @@ -26,6 +26,11 @@ allprojects {
resolutionStrategy {
force 'org.codehaus.groovy:groovy-all:2.4.5'
force 'org.spockframework:spock-core:1.0-groovy-2.4'
eachDependency {
if (it.requested.group == 'org.springframework') {
it.useVersion spinnaker.version('spring')
}
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion gate-web/gate-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {
compile spinnaker.dependency("korkWeb")
compile spinnaker.dependency("frigga")
compile spinnaker.dependency('cglib')
compile('org.springframework.session:spring-session-data-redis:1.0.1.RELEASE')
compile('org.springframework.session:spring-session-data-redis:1.1.1.RELEASE')
compile('org.opensaml:opensaml:2.6.4')

testCompile "com.squareup.okhttp:mockwebserver:${spinnaker.version('okHttp')}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package com.netflix.spinnaker.gate.config

import org.springframework.session.data.redis.config.ConfigureRedisAction
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession

import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import javax.servlet.*
Expand All @@ -38,11 +41,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.embedded.FilterRegistrationBean
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import org.springframework.core.Ordered
import org.springframework.core.annotation.Order
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory
import org.springframework.session.data.redis.config.annotation.web.http.GateRedisHttpSessionConfiguration
import org.springframework.stereotype.Component
import org.springframework.web.client.RestTemplate
import retrofit.Endpoint
Expand All @@ -54,7 +55,7 @@ import static retrofit.Endpoints.newFixedEndpoint
@CompileStatic
@Configuration
@Slf4j
@Import(GateRedisHttpSessionConfiguration)
@EnableRedisHttpSession
class GateConfig {
@Value('${retrofit.logLevel:BASIC}')
String retrofitLogLevel
Expand Down Expand Up @@ -82,6 +83,12 @@ class GateConfig {
new RestTemplate()
}

@Bean
@ConditionalOnProperty("redis.configuration.secure")
ConfigureRedisAction configureRedisAction() {
return ConfigureRedisAction.NO_OP
}

@Bean
ExecutorService executorService() {
Executors.newCachedThreadPool()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AnonymousSecurityConfig implements WebSecurityAugmentor {
AuthenticationManager authenticationManager) {
def filter = new AnonymousAuthenticationFilter(
// it seems like a smell that this is statically initialized with the allowedAccounts
key, new User(defaultEmail, null, null, ["anonymous"], anonymousAccountsService.getAllowedAccounts()), [new SimpleGrantedAuthority("anonymous")]
key, new User(email: defaultEmail, roles: ["anonymous"], allowedAccounts: anonymousAccountsService.getAllowedAccounts(), username: defaultEmail), [new SimpleGrantedAuthority("anonymous")]
)
http.addFilter(filter)
http.csrf().disable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class OAuth2SecurityConfig implements WebSecurityAugmentor {
@Override
Authentication extractAuthentication(Map<String, ?> map) {
def allowedAccounts = (map.scope ?: []).collect { String scope -> scope.replace("spinnaker_", "")}
def user = new User(map.client_id as String, null, null, [], allowedAccounts)
def user = new User(email: map.client_id as String, roles: [], allowedAccounts: allowedAccounts, username: map.client_id)
return new UsernamePasswordAuthenticationToken(user, "N/A", [])
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ class SAMLSecurityController {
}

def user = new User(
assertion.getSubject().nameID.value,
attributes[userAttributeMapping.firstName]?.get(0),
attributes[userAttributeMapping.lastName]?.get(0),
roles,
allowedAccounts
email: assertion.getSubject().nameID.value,
firstName: attributes[userAttributeMapping.firstName]?.get(0),
lastName: attributes[userAttributeMapping.lastName]?.get(0),
roles: roles,
allowedAccounts: allowedAccounts,
username: assertion.getSubject().nameID.value
)

return user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class X509AuthenticationProvider implements AuthenticationProvider {
}?.get(1) ?: authentication.principal

return new PreAuthenticatedAuthenticationToken(
new User(rfc822Name as String, null, null, [], anonymousAccountsService.allowedAccounts),
new User(email: rfc822Name, roles: [], allowedAccounts: anonymousAccountsService.allowedAccounts, username: rfc822Name),
authentication.credentials)
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BuildControllerSpec extends Specification {
void setup() {
igorService = Mock(IgorService)
buildService = new BuildService(igorService: igorService)
server.play()
server.start()
mockMvc = MockMvcBuilders.standaloneSetup(new BuildController(buildService: buildService)).build()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class CredentialsServiceSpec extends Specification {
expect:
AuthenticatedRequest.propagate({
new CredentialsService(clouddriverService: clouddriverService).getAccounts()
}, false, new User("email", null, null, [], userAccounts)).call() as List<ClouddriverService.Account> == allowedACcounts
}, false, new User(email: "email", roles: [], allowedAccounts: userAccounts, username: "email")).call() as List<ClouddriverService.Account> == allowedAccounts

where:
userAccounts || allowedACcounts
userAccounts || allowedAccounts
["account1"] || [accounts[0]]
["account2"] || [accounts[1]]
["account1", "account2"] || accounts
Expand Down

0 comments on commit bd6d60f

Please sign in to comment.