Created
February 17, 2022 14:16
-
-
Save seolys/8c3adbd142405eaf6eb8befb4572a7dd to your computer and use it in GitHub Desktop.
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
import java.util.Base64; | |
import org.springframework.security.crypto.factory.PasswordEncoderFactories; | |
public class ClientSecretGenerator { | |
/** | |
* encode clientId,clientSecret | |
* clientId:clientSecret | |
*/ | |
public static String base64EncodeAuthrizationBasicHeader(final String clientId, final String clientSecret) { | |
final String pattern = String.format("%s:%s", clientId, clientSecret); | |
return Base64.getUrlEncoder().encodeToString(pattern.getBytes()); | |
} | |
/** | |
* oauth_client_details > client_secret | |
*/ | |
public static String encryptClientSecret(final String clientSecret) { | |
return PasswordEncoderFactories.createDelegatingPasswordEncoder().encode(clientSecret); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment