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

com.jd.httpservice.agent.AuthorizationHeader Maven / Gradle / Ivy

There is a newer version: 2.1.4.RELEASE
Show newest version
package com.jd.httpservice.agent;


/***
 * Http Authorization Header;
 * 
 * @author haiq
 *
 */
public class AuthorizationHeader implements RequestHeader{

	/**@see com.jd.httpservice.agent.AuthorizationAlgs*/
	private String alg;				//算法类型
	
	private String senderName;		//开发者注册的用户名
	
	private String secretKey;		//秘钥
	
	public AuthorizationHeader(){
		
	}
	
	public AuthorizationHeader(String senderName, String secretKey){
		this(AuthorizationAlgs.DEFAULT, senderName, secretKey);
	}
	
	public AuthorizationHeader(String alg, String senderName, String secretKey){
		this.alg = alg;
		this.senderName = senderName;
		this.secretKey = secretKey;
	}

	public String getAlg() {
		return alg;
	}

	public String getSenderName() {
		return senderName;
	}

	public String getSecretKey() {
		return secretKey;
	}

	@Override
	public String getName() {
		return "Authorization";
	}

	@Override
	public String getValue() {
		StringBuilder authBuilder = new StringBuilder();
		authBuilder.append(alg).append(" ").append(senderName).append(":")
				.append(secretKey);
		return authBuilder.toString();
	}
	
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy