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

upgrade to latest dependencies #218

Merged
merged 1 commit into from
May 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spring-session-data-redis is a patch release or two different than the version spring-boot brings in, so this will keep them in sync for now

}
}
}
}

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')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lets us get rid of some dirty hackery we had to make spring-session-data-redis work with elasticache (see below for details)

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")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the redis instance is locked down such that you can't issue config set ops against it, set redis.configuration.secure=true and configure the redis instance directly (this is needed for AWS elasticache redis)

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