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

com.xiaomi.infra.galaxy.sds.thrift.AuthenticationConstants Maven / Gradle / Ivy

There is a newer version: 1.3.2
Show newest version
/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.xiaomi.infra.galaxy.sds.thrift;

import libthrift091.scheme.IScheme;
import libthrift091.scheme.SchemeFactory;
import libthrift091.scheme.StandardScheme;

import libthrift091.scheme.TupleScheme;
import libthrift091.protocol.TTupleProtocol;
import libthrift091.protocol.TProtocolException;
import libthrift091.EncodingUtils;
import libthrift091.TException;
import libthrift091.async.AsyncMethodCallback;
import libthrift091.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
public class AuthenticationConstants {

  /**
   * 登录方式是否支持签名
   */
  public static final Map SIGNATURE_SUPPORT = new HashMap();
  static {
    SIGNATURE_SUPPORT.put(com.xiaomi.infra.galaxy.sds.thrift.UserType.DEV_XIAOMI_SSO, false);
    SIGNATURE_SUPPORT.put(com.xiaomi.infra.galaxy.sds.thrift.UserType.DEV_XIAOMI, true);
    SIGNATURE_SUPPORT.put(com.xiaomi.infra.galaxy.sds.thrift.UserType.APP_SECRET, true);
    SIGNATURE_SUPPORT.put(com.xiaomi.infra.galaxy.sds.thrift.UserType.APP_ACCESS_TOKEN, true);
    SIGNATURE_SUPPORT.put(com.xiaomi.infra.galaxy.sds.thrift.UserType.APP_XIAOMI_SSO, false);
    SIGNATURE_SUPPORT.put(com.xiaomi.infra.galaxy.sds.thrift.UserType.APP_ANONYMOUS, false);
  }

  /**
   * 签名相关的HTTP头,
   * 根据分层防御的设计,使用HTTPS也建议进行签名:
   * http://bitcoin.stackexchange.com/questions/21732/why-api-of-bitcoin-exchanges-use-hmac-over-https-ssl
   */
  public static final String HK_HOST = "Host";

  /**
   * 签名时间,1970/0/0开始的秒数,如客户端与服务器时钟相差较大,会返回CLOCK_TOO_SKEWED错误
   */
  public static final String HK_TIMESTAMP = "X-Xiaomi-Timestamp";

  public static final String HK_CONTENT_MD5 = "X-Xiaomi-Content-MD5";

  /**
   * 内容为TJSONTransport.encode(HttpAuthorizationHeader)
   */
  public static final String HK_AUTHORIZATION = "Authorization";

  /**
   * 建议签名应包含的HTTP头
   */
  public static final List SUGGESTED_SIGNATURE_HEADERS = new ArrayList();
  static {
    SUGGESTED_SIGNATURE_HEADERS.add("Host");
    SUGGESTED_SIGNATURE_HEADERS.add("X-Xiaomi-Timestamp");
    SUGGESTED_SIGNATURE_HEADERS.add("X-Xiaomi-Content-MD5");
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy