Skip to content

Commit

Permalink
OP 22248 | Bugfix | Password id is null | ISD-Argo (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh-opsmx authored Jun 17, 2024
1 parent df6e478 commit b81d77d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
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

0 comments on commit b81d77d

Please sign in to comment.