Skip to content

Gtting 401 error with client generated Kerbeors token added to .net 7 httpclient #361

@RussKahler1970

Description

@RussKahler1970

Describe the bug
cannot get token to authenticate

To Reproduce
.net 7 app Using httpclient with UserDeaultCredentials set to falue

            var client = ClientFactory.CreateClient("SuperAssociate");
            HttpContent inputContent = new StringContent(GetEvent(), System.Text.Encoding.UTF8, "application/json");

            DnsQuery.RegisterImplementation(new PlatformIndependentDnsClient());

            var kClient = new KerberosClient();
            var kerbCred = new KerberosPasswordCredential("XXXXXX", "YYYYYYY", "salelytics.local");

            await kClient.Authenticate(kerbCred);

            var ticket = await kClient.GetServiceTicket("host/webtest01.salelytics.local");
                            
            var apiHost = "http://webtest01.salelytics.local/";
            Guard.Against.NullOrEmpty(apiHost);

            client.BaseAddress = new Uri(apiHost);
            var apiSite = "SuperAssociateRuss/api/IncomingEvent/";
            
             client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Negotiate", Convert.ToBase64String(ticket.EncodeGssApi().ToArray())); 


            var apiResponse = await client.PostAsync(apiSite, inputContent); 

Expected behavior
The Authorization Header should validate as my user

The token I get from Kerbeoros.Net is different from the one my chrome browser is sending. should it be the same?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions