All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yodlee.sdk.builder.JWTAppContextBuilder Maven / Gradle / Ivy

There is a newer version: 1.0.29.beta1
Show newest version
/**
 * Copyright (c) 2019 Yodlee, Inc. All Rights Reserved.
 *
 * Licensed under the MIT License. See LICENSE file in the project root for license information.
 */
package com.yodlee.sdk.builder;

import com.yodlee.sdk.api.exception.ApiException;
import com.yodlee.sdk.configuration.cobrand.JWTAppConfiguration;
import com.yodlee.sdk.context.JWTAppContext;

public class JWTAppContextBuilder implements Builder {

	/**
	 * This method is used to obtain JWT Cobrand context which can be used to invoke any Cobrand bound API. This JWT
	 * Cobrand context holds a JWT token generated during the invocation of this method.
	 * 
	 * @param jwtConfiguration - {@link JWTAppConfiguration}
	 * @return {@link JWTAppContext}
	 * @throws ApiException - {@link ApiException}
	 */
	public JWTAppContext build(JWTAppConfiguration jwtConfiguration) throws ApiException {
		ConfigValidationUtil.validateConfig(jwtConfiguration);
		String jwtToken = JWTUtil.getJWTToken(jwtConfiguration.getApiKey(), jwtConfiguration.getPrivateKey(), null,
				jwtConfiguration.getExpiresIn(), jwtConfiguration.getLocale());
		return new JWTAppContext(jwtToken, jwtConfiguration);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy