public void TestMethod2() { CAuthorizationCode code = ssoUtil.GetAuthorzationCodeWithLogin(user_email, user_password).FromJSON <CAuthorizationCode>(); CAccessToken token = ssoUtil.GetAccessToken(code.code).FromJSON <CAccessToken>(); Console.WriteLine(token.ToJSON()); }
public void TestMethod3() { CAuthorizationCode code = ssoUtil.GetAuthorzationCodeWithLogin(user_email, user_password).FromJSON <CAuthorizationCode>(); Console.WriteLine(code.ToJSON()); Console.WriteLine(); CAccessToken token = ssoUtil.GetAccessToken(code.code).FromJSON <CAccessToken>(); Console.WriteLine(token.ToJSON()); Console.WriteLine(); CExternalKey externalkey = ssoUtil.GetExternalKey(token.access_token).FromJSON <CExternalKey>(); Console.WriteLine(externalkey.ToJSON()); }
/// <summary> /// 인증 코드로 유저 정보 받아오기 /// </summary> /// <param name="code"></param> /// <returns> /// {"tenantId":147921,"domainId":147921,"master":false,"manager":false,"absence":false,"resigned":false,"standby":false,"externalKey":"20190501_P183","email":"*****@*****.**","name":{"lastName":"박주환","firstName":"","phoneticLastName":"","phoneticFirstName":""},"i18nNames":[{"language":"en_US","firstName":"","lastName":"박주환"}],"privateEmail":"*****@*****.**","aliasEmails":[],"employmentTypeExternalKey":"JC00002_P183","searchable":true,"organizations":[{"domainId":147921,"externalKey":"20190501_P183","represent":true,"levelExternalKey":"1900_P183","email":"*****@*****.**","orgUnits":[{"externalKey":"G0000019_P183","represent":true,"positionExternalKey":"2100_P183","position":"사원","manager":false,"display":true,"receiveEmail":true,"representDomain":false}],"executive":false,"name":"스포츠투아이㈜"}],"relations":[],"telephone":"070-7618-2558","cellphone":"010-7183-6745","location":"","hireDate":"2019.05.07","locale":"ko_KR","timeZone":"Asia/Seoul","customField":{}} /// </returns> public string LogInProcess(string code) { StringBuilder result = new StringBuilder(); try { if (code != null) { CAccessToken token = ssoUtil.GetAccessToken(code).FromJSON <CAccessToken>(); if (token.access_token != null) { CExternalKey externalkey = ssoUtil.GetExternalKey(token.access_token).FromJSON <CExternalKey>(); if (externalkey.user_id != null) { result.Append(userInfo.GetUsersInfo(api_id, domainId, externalkey.user_id)); } else { result.Append(externalkey.ToJSON()); } } else { result.Append(token.ToJSON()); } } else { result.Append(code.ToJSON()); } } catch (Exception e) { return(e.Message); } return(result.ToString()); }