Exemplo n.º 1
0
        // GET: api/Values
        public IEnumerable <string> GetUserIdentity()
        {
            string apikey = "";

            if (!string.IsNullOrEmpty(HttpRequestMessageApiKeyExtension.GetApiKey(this.Request)))
            {
                apikey = HttpRequestMessageApiKeyExtension.GetApiKey(this.Request).ToString();
            }
            return(new string[] { User.Identity.Name, User.Identity.AuthenticationType, User.Identity.IsAuthenticated.ToString(), User.IsInRole("admin").ToString(), apikey.ToString() });
        }
Exemplo n.º 2
0
        // GET: api/Values
        public IEnumerable <string> GetUserApiKey()
        {
            string apikey = "";

            if (!string.IsNullOrEmpty(HttpRequestMessageApiKeyExtension.GetApiKey(this.Request)))
            {
                apikey = HttpRequestMessageApiKeyExtension.GetApiKey(this.Request).ToString();
            }

            return(new string[] { "value1", "value2", apikey });
        }