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

OP 22248 | Bugfix | Password id is null | ISD-Argo #475

Merged
merged 9 commits into from
Jun 17, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public BasicAuthConfig(AuthConfig authConfig, BasicAuthProvider authProvider) {
this.authProvider = authProvider;
}

@Bean
public AuthenticationManager authManager(HttpSecurity http) throws Exception {
private AuthenticationManager authManager(HttpSecurity http) throws Exception {
AuthenticationManagerBuilder authenticationManagerBuilder =
http.getSharedObject(AuthenticationManagerBuilder.class);
if (name == null || name.isEmpty() || password == null || password.isEmpty()) {
Expand Down Expand Up @@ -95,6 +94,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf().disable();
http.formLogin()
.and()
.authenticationManager(authManager(http))
.httpBasic()
.authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/login"));
authConfig.configure(http);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.netflix.spinnaker.gate.security.basic;

import com.netflix.spinnaker.gate.services.OesAuthorizationService;
import com.netflix.spinnaker.gate.services.PermissionService;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
Expand All @@ -39,7 +38,6 @@
@Component
public class BasicAuthProvider implements AuthenticationProvider {

private final PermissionService permissionService;
private final OesAuthorizationService oesAuthorizationService;

@Value("${services.platform.enabled:false}")
Expand All @@ -53,9 +51,7 @@ public class BasicAuthProvider implements AuthenticationProvider {
private Boolean isFiatEnabled;

@Autowired
public BasicAuthProvider(
PermissionService permissionService, OesAuthorizationService oesAuthorizationService) {
this.permissionService = permissionService;
public BasicAuthProvider(OesAuthorizationService oesAuthorizationService) {
this.oesAuthorizationService = oesAuthorizationService;
}

Expand All @@ -72,14 +68,13 @@ public Authentication authenticate(Authentication authentication) throws Authent

List<GrantedAuthority> grantedAuthorities = new ArrayList<>();

if (roles != null && !roles.isEmpty() && permissionService != null) {
if (roles != null && !roles.isEmpty() && isPlatformEnabled) {
grantedAuthorities.addAll(
roles.stream()
.map(role -> new SimpleGrantedAuthority(role))
.collect(Collectors.toList()));
// Updating roles in fiat service
permissionService.loginWithRoles(name, roles);
log.debug("Platform service enabled value :{}", isPlatformEnabled);

// Updating roles in platform service
if (isPlatformEnabled) {
oesAuthorizationService.cacheUserGroups(roles, name);
Expand Down
Loading