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

com.yodlee.sdk.context.AbstractClientCredentialContext Maven / Gradle / Ivy

There is a newer version: 1.0.31
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.context;

import com.yodlee.sdk.configuration.cobrand.AbstractClientCredentialConfiguration;

public abstract class AbstractClientCredentialContext extends AbstractContext {

	private static final long serialVersionUID = 1L;

	private String accessToken;

	private String issuedAt;

	private int expiresIn;

	private String contextHeader;

	private final C clientCredentialConfiguration;

	private boolean autoRenew;

	public AbstractClientCredentialContext(String accessToken, String issuedAt, int expiresIn,
			C clientCredentialConfiguration) {
		this.clientCredentialConfiguration = clientCredentialConfiguration;
		this.accessToken = accessToken;
		this.issuedAt = issuedAt;
		this.expiresIn = expiresIn;
		this.autoRenew = true;
		updateContextHeader(accessToken);
	}

	@Override
	public ContextType getContextType() {
		return ContextType.COBRAND;
	}

	@Override
	public C getConfiguration() {
		return clientCredentialConfiguration;
	}

	@Override
	protected String getContextHeader() {
		return contextHeader;
	}

	public String getAccessToken() {
		return accessToken;
	}

	public void setAccessToken(String accessToken) {
		this.accessToken = accessToken;
	}

	public String getIssuedAt() {
		return issuedAt;
	}

	public void setIssuedAt(String issuedAt) {
		this.issuedAt = issuedAt;
	}

	public int getExpiresIn() {
		return expiresIn;
	}

	public void setExpiresIn(int expiresIn) {
		this.expiresIn = expiresIn;
	}

	private void updateContextHeader(String accessToken) {
		contextHeader = String.format("Bearer %s", accessToken);
	}

	@Override
	public boolean isAutoRenew() {
		return autoRenew;
	}

	@Override
	public void setAutoRenew(boolean autoRenew) {
		this.autoRenew = autoRenew;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy