Skip to content

Commit

Permalink
feat: log error when refreshing token
Browse files Browse the repository at this point in the history
OCD-4777
  • Loading branch information
tmy1313 committed Dec 13, 2024
1 parent 97482b2 commit f830c88
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.stereotype.Component;

import jakarta.annotation.PostConstruct;

/**
* A Spring singleton object object that provides a reference to the Quartz Scheduler.
* @author TYoung
Expand All @@ -16,18 +14,24 @@
@Scope(value = "singleton")
@Component
public class ChplSchedulerReference {
@Autowired
private SchedulerFactoryBean schedulerFactory;
//@Autowired
//private SchedulerFactoryBean schedulerFactory;

private Scheduler scheduler;

@Autowired
public ChplSchedulerReference(SchedulerFactoryBean schedulerFactory) {
this.scheduler = schedulerFactory.getScheduler();
}


/**
* Initialize the scheduler service
*/
@PostConstruct
private void init() {
scheduler = schedulerFactory.getScheduler();
}
//@PostConstruct
//private void init() {
// scheduler = schedulerFactory.getScheduler();
//}

public Scheduler getScheduler() {
return scheduler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class JobAspect {

@After("execution(public void org.quartz.Job.execute(..))")
public void logAfter(JoinPoint joinPoint) {
public void afterExecute(JoinPoint joinPoint) {
SecurityContextHolder.clearContext();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public CognitoCredentials createUser(CreateUserRequest userRequest) throws UserC
public AuthenticationResultType refreshToken(String refreshToken, UUID cognitoId) {
Map<String, String> authParams = new LinkedHashMap<String, String>();
authParams.put("REFRESH_TOKEN", refreshToken);
authParams.put("SECRET_HASH", calculateSecretHash(cognitoId.toString()));
authParams.put("SECRET_HASH", calculateSecretHash(cognitoId.toString()));

AdminInitiateAuthRequest authRequest = AdminInitiateAuthRequest.builder()
.authFlow(AuthFlowType.REFRESH_TOKEN_AUTH)
Expand All @@ -263,7 +263,7 @@ public AuthenticationResultType refreshToken(String refreshToken, UUID cognitoId
} catch (Exception e) {
//This is cluttering the logs when the SSO flag is on, and the user logs in using CHPL creds
//We might want to uncomment it when we move to only using Cognito creds
//LOGGER.error("Error refreshing token", e);
LOGGER.error("Error refreshing token", e);
return null;
}
}
Expand Down

0 comments on commit f830c88

Please sign in to comment.