コード例 #1
0
 public ServiceFactory()
 {
     AuthConfig = new AuthConfig();
     AuthConfig.ApiAccessKey = ConfigurationManager.AppSettings["ALMSApiAccessKey"];
     AuthConfig.ApiSecretKey = ConfigurationManager.AppSettings["ALMSApiSecretKey"];
     BaseApiURI = ConfigurationManager.AppSettings["ALMSBaseApiURI"];
 }
コード例 #2
0
        protected internal static string GenerateNonce(AuthConfig config, DateTimeOffset httpRequestUTCDate)
        {
            string content = config.ApiAccessKey + " " + httpRequestUTCDate.ToString(CultureInfo.CurrentCulture.DateTimeFormat.RFC1123Pattern);

            byte[] keyByte = System.Text.Encoding.UTF8.GetBytes(config.ApiSecretKey);
            var hmacsha256 = new System.Security.Cryptography.HMACSHA256(keyByte);

            byte[] messageBytes = System.Text.Encoding.UTF8.GetBytes(content);
            byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);

            string sbinary = "";
            for (int i = 0; i < hashmessage.Length; i++) sbinary += hashmessage[i].ToString("X2"); // hex format
            return sbinary;
        }
コード例 #3
0
 public MasterCourseService(AuthConfig authConfig, string baseApiURI)
     : base(authConfig, baseApiURI)
 {
 }
コード例 #4
0
 public OrganizationService(AuthConfig authConfig, string baseApiURI)
     : base(authConfig, baseApiURI)
 {
 }
コード例 #5
0
 public GroupService(AuthConfig authConfig, string baseApiURI)
     : base(authConfig, baseApiURI)
 {
 }
コード例 #6
0
 public UserService(AuthConfig authConfig, string baseApiURI)
     : base(authConfig, baseApiURI)
 {
 }
コード例 #7
0
 public ClassService(AuthConfig authConfig, string baseApiURI)
     : base(authConfig, baseApiURI)
 {
 }