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);
            }
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 3
0
        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);
            }
        }