コード例 #1
0
        public IHttpActionResult GetAllExpired()
        {
            try
            {
                AdalClient _client = new AdalClient(_appConfig, CredentialType.Client, null);
                ServicePrincipalFactory _f = new ServicePrincipalFactory();
                var _manager = _f.CreateInstance(_client);
                var _servicePrincipals = _manager.GetExpiredPrincipals();
                return Ok(_servicePrincipals);

            }
            catch (TIPException ex)
            {
                var _response = new ErrorResponse();
                _response.Error = ex.Error;
                return Content(HttpStatusCode.InternalServerError, _response);
            }
            catch(Exception ex)
            {
                var _response = new ErrorResponse();
                _response.Error = new Error
                {
                    Code = Common.Constants.ErrorCodes.GENERAL,
                    Message = ex.Message
                };
                return Content(HttpStatusCode.InternalServerError, _response);
            }
        }
コード例 #2
0
 public IHttpActionResult GetTenantInformation()
 {
     AdalClient _client = new AdalClient(_appConfig, CredentialType.Client, null);
     try
     {
         TenantFactory _f = new TenantFactory();
         var _manager = _f.CreateInstance(_client);
         var _tenantInfo = _manager.GetTenantInformation();
         return Ok(_tenantInfo);
     }
     catch (TIPException _ex)
     {
         var _errorResponse = new ErrorResponse();
         _errorResponse.Error = _ex.Error;
         return Content(HttpStatusCode.InternalServerError, _errorResponse);
     }
     catch (Exception ex)
     {
         var _response = new ErrorResponse();
         _response.Error = new Error
         {
             Code = Common.Constants.ErrorCodes.GENERAL,
             Message = ex.Message
         };
         return Content(HttpStatusCode.InternalServerError, _response);
     }
 }
コード例 #3
0
ファイル: MeController.cs プロジェクト: RapidCircle/PnP-Tools
        public IHttpActionResult GetMe()
        {
            AdalClient _client = new AdalClient(_appConfig, CredentialType.Client, null);

            try
            {
                var _applicationFactory = new ApplicationFactory();
                var _manager = _applicationFactory.CreateInstance(_client);
                var _app = _manager.GetApplicationById(_client.ServiceInformation.ClientID);
                return Ok(_app);

            }
            catch (Exception _ex)
            {
                var _response = new ErrorResponse();
                _response.Error = new Error
                {
                    Code = Common.Constants.ErrorCodes.GENERAL,
                    Message = _ex.Message
                };
                return Content(HttpStatusCode.InternalServerError, _response);
            }
        }