use of org.wso2.carbon.apimgt.common.gateway.dto.JWTConfigurationDto in project carbon-apimgt by wso2.
the class APIAuthenticationHandler method initOAuthParams.
protected void initOAuthParams() {
setKeyValidator();
APIManagerConfiguration config = getApiManagerConfiguration();
String value = config.getFirstProperty(APIConstants.REMOVE_OAUTH_HEADERS_FROM_MESSAGE);
if (value != null) {
removeOAuthHeadersFromOutMessage = Boolean.parseBoolean(value);
}
JWTConfigurationDto jwtConfigurationDto = config.getJwtConfigurationDto();
if (jwtConfigurationDto != null) {
value = jwtConfigurationDto.getJwtHeader();
}
if (value != null) {
setSecurityContextHeader(value);
}
isOauthParamsInitialized = true;
}
use of org.wso2.carbon.apimgt.common.gateway.dto.JWTConfigurationDto in project carbon-apimgt by wso2.
the class ApiKeyAuthenticator method getContextHeader.
public String getContextHeader() {
APIManagerConfiguration apimConf = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration();
JWTConfigurationDto jwtConfigDto = apimConf.getJwtConfigurationDto();
return jwtConfigDto.getJwtHeader();
}
use of org.wso2.carbon.apimgt.common.gateway.dto.JWTConfigurationDto in project carbon-apimgt by wso2.
the class APIKeyMgtDataHolder method isJwtGenerationEnabled.
public static boolean isJwtGenerationEnabled() {
APIManagerConfiguration configuration = org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration();
if (configuration == null) {
return false;
}
JWTConfigurationDto jwtConfigurationDto = configuration.getJwtConfigurationDto();
return jwtConfigurationDto.isEnabled();
}
use of org.wso2.carbon.apimgt.common.gateway.dto.JWTConfigurationDto in project carbon-apimgt by wso2.
the class APIKeyMgtDataHolder method initData.
public static void initData() {
try {
APIKeyMgtDataHolder.isKeyCacheEnabledKeyMgt = getInitValues(APIConstants.KEY_MANAGER_TOKEN_CACHE);
APIManagerConfiguration configuration = org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration();
if (configuration == null) {
log.error("API Manager configuration is not initialized");
} else {
ExtendedJWTConfigurationDto jwtConfigurationDto = configuration.getJwtConfigurationDto();
if (log.isDebugEnabled()) {
log.debug("JWTGeneration enabled : " + jwtConfigurationDto.isEnabled());
}
if (jwtConfigurationDto.isEnabled()) {
if (jwtConfigurationDto.getJwtGeneratorImplClass() == null) {
tokenGenerator = new JWTGenerator();
} else {
try {
tokenGenerator = (TokenGenerator) APIUtil.getClassInstance(jwtConfigurationDto.getJwtGeneratorImplClass());
} catch (InstantiationException e) {
log.error("Error while instantiating class " + jwtConfigurationDto.getJwtGeneratorImplClass(), e);
} catch (IllegalAccessException e) {
log.error(e);
} catch (ClassNotFoundException e) {
log.error("Cannot find the class " + jwtConfigurationDto.getJwtGeneratorImplClass() + e);
}
}
}
}
} catch (Exception e) {
log.error("Error occur while initializing API KeyMgt Data Holder.Default configuration will be used." + e.toString());
}
}
Aggregations