|
|
@ -36,11 +36,11 @@ import org.apache.http.util.EntityUtils;
|
|
|
|
import org.wso2.carbon.base.MultitenantConstants;
|
|
|
|
import org.wso2.carbon.base.MultitenantConstants;
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
|
import org.wso2.carbon.core.util.KeyStoreManager;
|
|
|
|
import org.wso2.carbon.core.util.KeyStoreManager;
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService;
|
|
|
|
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.dto.JWTConfig;
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.dto.JWTConfig;
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientConfigurationException;
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientConfigurationException;
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException;
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.exception.JWTClientException;
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.internal.JWTClientExtensionDataHolder;
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.internal.JWTClientExtensionDataHolder;
|
|
|
|
|
|
|
|
import org.wso2.carbon.identity.jwt.client.extension.service.JWTClientManagerService;
|
|
|
|
import org.wso2.carbon.registry.core.Registry;
|
|
|
|
import org.wso2.carbon.registry.core.Registry;
|
|
|
|
import org.wso2.carbon.registry.core.Resource;
|
|
|
|
import org.wso2.carbon.registry.core.Resource;
|
|
|
|
import org.wso2.carbon.registry.core.exceptions.RegistryException;
|
|
|
|
import org.wso2.carbon.registry.core.exceptions.RegistryException;
|
|
|
@ -48,24 +48,15 @@ import org.wso2.carbon.registry.core.service.RegistryService;
|
|
|
|
import org.wso2.carbon.registry.core.service.TenantRegistryLoader;
|
|
|
|
import org.wso2.carbon.registry.core.service.TenantRegistryLoader;
|
|
|
|
import org.wso2.carbon.utils.CarbonUtils;
|
|
|
|
import org.wso2.carbon.utils.CarbonUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
import java.io.*;
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
|
|
|
|
import java.net.URI;
|
|
|
|
import java.net.URI;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.security.KeyManagementException;
|
|
|
|
import java.security.*;
|
|
|
|
import java.security.KeyStore;
|
|
|
|
|
|
|
|
import java.security.KeyStoreException;
|
|
|
|
|
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
|
|
|
|
import java.security.UnrecoverableKeyException;
|
|
|
|
|
|
|
|
import java.security.cert.CertificateException;
|
|
|
|
import java.security.cert.CertificateException;
|
|
|
|
import java.security.interfaces.RSAPrivateKey;
|
|
|
|
import java.security.interfaces.RSAPrivateKey;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Properties;
|
|
|
|
import java.util.Properties;
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* This is the utility class that is used for JWT Client.
|
|
|
|
* This is the utility class that is used for JWT Client.
|
|
|
@ -210,7 +201,7 @@ public class JWTClientUtil {
|
|
|
|
long nbf = currentTimeMillis + jwtConfig.getValidityPeriodFromCurrentTime() * 60 * 1000;
|
|
|
|
long nbf = currentTimeMillis + jwtConfig.getValidityPeriodFromCurrentTime() * 60 * 1000;
|
|
|
|
String jti = jwtConfig.getJti();
|
|
|
|
String jti = jwtConfig.getJti();
|
|
|
|
if (jti == null) {
|
|
|
|
if (jti == null) {
|
|
|
|
String defaultTokenId = currentTimeMillis + "" + new Random().nextInt();
|
|
|
|
String defaultTokenId = currentTimeMillis + "" + new SecureRandom().nextInt();
|
|
|
|
jti = defaultTokenId;
|
|
|
|
jti = defaultTokenId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<String> aud = jwtConfig.getAudiences();
|
|
|
|
List<String> aud = jwtConfig.getAudiences();
|
|
|
|