Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Signon Fails because the specified Audience is not present in AudienceUris

I have a webapp which does signin request/send to my ADFS server. On the return it is directed to another app url; which i configured in my IIS server. I.E. the same url is configured in ADFS server also.

This error message follows

ID1038: The AudienceRestrictionCondition was not valid because the specified Audience is not present in AudienceUris. Audience:

Here is the code. Why does it fail as such?

issuerLocation = "https://test12.login.mytest.edu/adfs/ls/";
realm = "https://domain/SSO_Test/";           
this.Request.Url.AbsoluteUri.Remove(this.Request.Url.AbsoluteUri.IndexOf(this.Request.Url.Query, StringComparison.OrdinalIgnoreCase));
var contextId = Guid.NewGuid().ToString();
this.CreateContextCookie(contextId, this.Request.Url.AbsoluteUri);

var message = new SignInRequestMessage(new Uri(issuerLocation), realm)
{
    CurrentTime = DateTime.UtcNow.ToString("s", CultureInfo.InvariantCulture) + "Z", 
};

this.Response.Redirect(message.RequestUrl, false);
like image 762
user3527063 Avatar asked Apr 12 '14 15:04

user3527063


1 Answers

Sometimes it could be because of the trailing slash "/" ... which was the problem in my case. Copied the URL from the error message and added it to the audienceUris, and it started working fine.

like image 189
Gokulnath Avatar answered Nov 07 '22 14:11

Gokulnath