protected override Scope GetScope(ClaimsPrincipal principal, RequestSecurityToken request) { if (request?.AppliesTo == null) { throw new InvalidRequestException($"token request from {principal?.Identity?.Name} - but no realm specified."); } var rp = getRelyingParty(); if ( !string.Equals( rp?.Realm, request.AppliesTo.Uri.ToString(), StringComparison.InvariantCultureIgnoreCase) ) { throw new InvalidRequestException(string.Format($"The AppliesTo uri {request.AppliesTo.Uri} is not registered as a relying party.")); } var scope = new RequestScope(request.AppliesTo.Uri, rp); scope.ReplyToAddress = rp.RedirectUrl; request.TokenType = rp.TokenType; return scope; }
protected override Scope GetScope(ClaimsPrincipal principal, RequestSecurityToken request) { if (request?.AppliesTo == null) { throw new InvalidRequestException($"token request from {principal?.Identity?.Name} - but no realm specified."); } var rp = getRelyingParty(); if (!string.Equals(rp?.Realm, request.AppliesTo.Uri.ToString(), StringComparison.InvariantCultureIgnoreCase)) { throw new InvalidRequestException(string.Format($"The AppliesTo uri {request.AppliesTo.Uri} is not registered as a relying party.")); } var scope = new RequestScope(request.AppliesTo.Uri, rp); scope.ReplyToAddress = rp.RedirectUrl; request.TokenType = rp.TokenType; return(scope); }