Skip to content

Domain hint only specified when login hint is not null or blank #415

Description

@glasody

Which version of Microsoft Identity Web are you using?
0.2.1-preview

Where is the issue?

  • Web app

    • Sign-in users
    • Sign-in users and call web APIs
  • Web API

    • Protected web APIs (validating tokens)
    • Protected web APIs (validating scopes)
    • Protected web APIs call downstream web APIs
  • Token cache serialization

    • In-memory caches
    • Session caches
    • Distributed caches
  • Other (please describe)

Repro
Create new net core app
Add identity web auth
Define AzureAd properties in config file with domain property defined but no login hint

Runt the Web app and Web API

Expected behavior
Domain hint to be added to the authorization request even if login hint isn't specified

Actual behavior
domain hint doesn't get added to the authorization call

Possible solution
Move domain hint definition outside the if clause


Hi,

I was working with this package to get a web app running with Azure AD, but found that defining the domain did not add it into my authentication request thus not directly opening the federation login page.

I found that this was because domain_hint is only being added when login_hint is not blank or null.
Is this a bug? I was under the assumption that domain_hint could be provided without a login_hint.

var login = context.Properties.GetParameter<string>(OpenIdConnectParameterNames.LoginHint);
if (!string.IsNullOrWhiteSpace(login))
{
context.ProtocolMessage.LoginHint = login;
context.ProtocolMessage.DomainHint = context.Properties.GetParameter<string>(
OpenIdConnectParameterNames.DomainHint);
// delete the login_hint and domainHint from the Properties when we are done otherwise
// it will take up extra space in the cookie.
context.Properties.Parameters.Remove(OpenIdConnectParameterNames.LoginHint);
context.Properties.Parameters.Remove(OpenIdConnectParameterNames.DomainHint);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions