DigestAuthClient.java 381 Bytes
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
package com.lyms.cm.qiniu;

import org.apache.http.client.methods.HttpPost;

public class DigestAuthClient extends Client {
public Mac mac;
public DigestAuthClient(Mac mac) {
this.mac = mac;
}

@Override
public void setAuth(HttpPost post) throws AuthException {
String accessToken = mac.signRequest(post);
post.setHeader("Authorization", "QBox " + accessToken);
}

}