-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
152 additions
and
12 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
42 changes: 42 additions & 0 deletions
42
gate-core/src/main/java/com/netflix/spinnaker/gate/config/FileLoginResponse.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.netflix.spinnaker.gate.config; | ||
|
||
import java.io.Serializable; | ||
|
||
public class FileLoginResponse implements Serializable { | ||
|
||
private String username; | ||
private String password; | ||
private boolean validUser; | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public boolean isValidUser() { | ||
return validUser; | ||
} | ||
|
||
public void setValidUser(boolean validUser) { | ||
this.validUser = validUser; | ||
} | ||
|
||
public FileLoginResponse() {} | ||
|
||
public FileLoginResponse(String username, String password, boolean validUser) { | ||
this.setUsername(username); | ||
this.setPassword(password); | ||
this.setValidUser(validUser); | ||
} | ||
} |
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,5 @@ | ||
dependencies { | ||
implementation project(":gate-core") | ||
implementation "org.apache.commons:commons-lang3" | ||
implementation "org.springframework.session:spring-session-core" | ||
} |
55 changes: 55 additions & 0 deletions
55
gate-file/src/main/groovy/com/netflix/spinnaker/gate/security/file/FileSsoConfig.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,55 @@ | ||
package com.netflix.spinnaker.gate.security.file | ||
|
||
import com.netflix.spinnaker.gate.config.AuthConfig | ||
import com.netflix.spinnaker.gate.security.SpinnakerAuthConfig | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.security.authentication.AuthenticationManager | ||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity | ||
import org.springframework.security.config.annotation.web.builders.WebSecurity | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity | ||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter | ||
import org.springframework.security.core.userdetails.UserDetailsService | ||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder | ||
import org.springframework.security.crypto.password.PasswordEncoder | ||
|
||
@ConditionalOnExpression('${file.enabled:false}') | ||
@Configuration | ||
@SpinnakerAuthConfig | ||
@EnableWebSecurity | ||
class FileSsoConfig extends WebSecurityConfigurerAdapter { | ||
|
||
@Autowired | ||
AuthConfig authConfig | ||
|
||
@Autowired | ||
private UserDetailsService userDataService | ||
|
||
@Autowired | ||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { | ||
auth.userDetailsService(userDataService).passwordEncoder(passwordEncoder()); | ||
} | ||
|
||
@Bean | ||
public PasswordEncoder passwordEncoder() { | ||
return new BCryptPasswordEncoder(); | ||
} | ||
|
||
@Override | ||
protected void configure(AuthenticationManagerBuilder auth) throws Exception { | ||
auth.getDefaultUserDetailsService() | ||
} | ||
|
||
@Override | ||
protected void configure(HttpSecurity http) throws Exception { | ||
authConfig.jwtconfigure(http) | ||
} | ||
|
||
@Override | ||
void configure(WebSecurity web) throws Exception { | ||
authConfig.configure(web) | ||
} | ||
} |
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