コード例 #1
0
        public Stream FindByAuthorizationSessionID(string authorizationSessionID)
        {
            IFindAuthenticationCodeBusinessService businessService = (IFindAuthenticationCodeBusinessService)BusinessFactory.Create(Keywords.FindAuthenticationCode);
            OperationResult result = businessService.FindByAuthorizationSessionID(Convert.ToString(authorizationSessionID));

            return(result.ToJsonStream());
        }
コード例 #2
0
        public Stream FindByExpiredDateBetween(string expiredDate1, string expiredDate2)
        {
            IFindAuthenticationCodeBusinessService businessService = (IFindAuthenticationCodeBusinessService)BusinessFactory.Create(Keywords.FindAuthenticationCode);
            OperationResult result = businessService.FindByExpiredDateBetween(Convert.ToDateTime(expiredDate1), Convert.ToDateTime(expiredDate2));

            return(result.ToJsonStream());
        }
コード例 #3
0
        public Stream HandleAccessTokenRequest(string authorizationCode, string clientID, string clientSecret)
        {
            IHandleAccessTokenRequestBusinessService businessService = (IHandleAccessTokenRequestBusinessService)BusinessFactory.Create("Tools.OAuthServerManager.HandleAccessTokenRequest");
            OperationResult result = businessService.CheckClientIDAndClientSecret(clientID, clientSecret);

            if (result.Result)
            {
                result = businessService.CheckAuthorizationCode(clientID, clientSecret, authorizationCode);
                IFindAuthenticationCodeBusinessService authCodeBs = (IFindAuthenticationCodeBusinessService)BusinessFactory.Create("Find.Tools.OAuthServerManager.AuthenticationCode");
                OperationResult authCodeResult = authCodeBs.FindByAuthenticationCodeString(authorizationCode);

                if (result.Result)
                {
                    List <AuthenticationCode> codes = (List <AuthenticationCode>)authCodeResult.Data;
                    if (codes.Count > 0)
                    {
                        AuthenticationCode code = (AuthenticationCode)codes[0];
                        result = businessService.CreateAccessToken(code);
                        businessService.SaveAccessToken((AccessToken)result.Data);
                    }
                }
            }
            return(result.ToJsonStream());
        }