In spring boot projact, I want to handle oauth/token API. If credentials are correct, it successfully return status: 200 and other details (access token, refresh token, etc).
I created Java class Oauth2UserServiceImpl by implementing UserDetailsService. Then overrided loadUserByUsername method. Inside that, before checking the credential validity, I need to check whether this user’s status is ‘Active’ and password expiered. The following code shows the way I’m checking it.
if (!vendorEntity.getStatus().equals(UserStatus.ACTIVE)) throw new LBCLServiceException(INACTIVE_ACCOUNT, "This vendor has been deactivated.");
if (vendorEntity.is_temporary_password() && new Date().after(vendorEntity.getPassword_expiration())) throw new LBCLServiceException(UNAUTHORIZED_ACCESS, "Your login details have been expired.");
And this INACTIVE_ACCOUNT refers 605 status, TEMPORARY_PASSWORD_EXPIRED refers 705. My concern is, these status are not returning but always 401 returns in header.