public List<OAuthAuthorization> GetOAuthUserAuthorizations(String clientApiKey)
 {
     List<ClientAuthorization> authorizations =
         Authorization.GetUserAuthorizationsForClient(ArenaContext.Current.User.Identity.Name, clientApiKey, false);
     List<OAuthAuthorization> list = new List<OAuthAuthorization>();
     OAuthAuthorizationMapper mapper = new OAuthAuthorizationMapper();
     foreach (ClientAuthorization auth in authorizations)
     {
         list.Add(mapper.FromArena(auth));
     }
     return list;
 }
        public GenericListResult<OAuthAuthorization> GetOAuthUserAuthorizations(String clientApiKey)
        {
            List<ClientAuthorization> authorizations =
                Authorization.GetUserAuthorizationsForClient(ArenaContext.Current.User.Identity.Name, clientApiKey, false);
            GenericListResult<OAuthAuthorization> list = new GenericListResult<OAuthAuthorization>();
            list.Items = new List<OAuthAuthorization>();
            OAuthAuthorizationMapper mapper = new OAuthAuthorizationMapper();
            foreach (ClientAuthorization auth in authorizations)
            {
                list.Items.Add(mapper.FromArena(auth));
            }
            list.Total = list.Max = list.Items.Count();
            list.Start = 0;

            return list;
        }
Exemple #3
0
        public ModifyResult UpdateOAuthUserAuthorization(String clientApiKey, OAuthAuthorization auth)
        {
            Arena.Custom.SECC.OAuth.Client client = new Arena.Custom.SECC.OAuth.Client(new Guid(clientApiKey));
            if (auth.ClientId != client.ClientId)
            {
                throw new ResourceNotFoundException("Client API Key mismatch.");
            }

            // Create the mapper
            Arena.Custom.HDC.WebService.Contracts.OAuthAuthorizationMapper mapper =
                new Arena.Custom.HDC.WebService.Contracts.OAuthAuthorizationMapper();
            if (auth.AuthorizationId > 0)
            {
                return(mapper.Update(auth));
            }
            else
            {
                return(mapper.Create(auth));
            }
        }
Exemple #4
0
        public ModifyResult UpdateOAuthUserAuthorization(Stream input, int id)
        {
            /*StreamReader reader = new StreamReader(input);
             * String content = reader.ReadToEnd();*/

            XmlSerializer      xmlSerializer = new XmlSerializer(typeof(OAuthAuthorization));
            OAuthAuthorization auth          = (OAuthAuthorization)xmlSerializer.Deserialize(input);

            // Create the mapper
            Arena.Custom.HDC.WebService.Contracts.OAuthAuthorizationMapper mapper =
                new Arena.Custom.HDC.WebService.Contracts.OAuthAuthorizationMapper();
            if (auth.AuthorizationId > 0)
            {
                return(mapper.Update(auth));
            }
            else
            {
                return(mapper.Create(auth));
            }
        }
        public ModifyResult UpdateOAuthUserAuthorization(String clientApiKey, OAuthAuthorization auth)
        {
            Arena.Custom.SECC.OAuth.Client client = new Arena.Custom.SECC.OAuth.Client(new Guid(clientApiKey));
            if (auth.ClientId != client.ClientId)
            {
                throw new ResourceNotFoundException("Client API Key mismatch.");
            }

            // Create the mapper
            Arena.Custom.HDC.WebService.Contracts.OAuthAuthorizationMapper mapper =
                new Arena.Custom.HDC.WebService.Contracts.OAuthAuthorizationMapper();
            if (auth.AuthorizationId > 0)
            {
                return mapper.Update(auth);
            }
            else
            {
                return mapper.Create(auth);
            }
        }
        public ModifyResult UpdateOAuthUserAuthorization(Stream input, int id)
        {
            /*StreamReader reader = new StreamReader(input);
            String content = reader.ReadToEnd();*/

            XmlSerializer xmlSerializer = new XmlSerializer(typeof(OAuthAuthorization));
            OAuthAuthorization auth = (OAuthAuthorization)xmlSerializer.Deserialize(input);

            // Create the mapper
            Arena.Custom.HDC.WebService.Contracts.OAuthAuthorizationMapper mapper =
                new Arena.Custom.HDC.WebService.Contracts.OAuthAuthorizationMapper();
            if (auth.AuthorizationId > 0)
            {
                return mapper.Update(auth);
            }
            else
            {
                return mapper.Create(auth);
            }
        }