<%-- /** * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2013 ForgeRock Inc. All Rights Reserved * * The contents of this file are subject to the terms * of the Common Development and Distribution License * (the License). You may not use this file except in * compliance with the License. * * You can obtain a copy of the License at * http://forgerock.org/license/CDDLv1.0.html * See the License for the specific language governing * permission and limitations under the License. * * When distributing Covered Code, include this CDDL * Header Notice in each file and include the License file * at http://forgerock.org/license/CDDLv1.0.html * If applicable, add the following below the CDDL Header, * with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * */ --%> <%@ Page Language="C#" MasterPageFile="~/site.master" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="System.Xml" %> <%@ Import Namespace="Sun.Identity.Saml2" %> <%@ Import Namespace="Sun.Identity.Saml2.Exceptions" %> <% string errorMessage = null; string errorTrace = null; AttributeQueryResponse queryResponse = null; ServiceProviderUtility serviceProviderUtility = (ServiceProviderUtility)Cache["spu"]; if (serviceProviderUtility == null) { serviceProviderUtility = new ServiceProviderUtility(Context); Cache["spu"] = serviceProviderUtility; } NameValueCollection parameters = Saml2Utils.GetRequestParameters(Request); string idpEntityId = parameters[Saml2Constants.IdpEntityId]; try { // Check for required parameters... if (String.IsNullOrEmpty(idpEntityId)) { throw new ServiceProviderUtilityException("IDP Entity ID not specified."); } else if (String.IsNullOrEmpty(parameters[Saml2Constants.SubjectNameId])) { throw new ServiceProviderUtilityException("SubjectNameId not specified."); } List attributes = new List(); if (!String.IsNullOrEmpty(parameters["attr1"])) { attributes.Add(new SamlAttribute(parameters["attr1"])); } if (!String.IsNullOrEmpty(parameters["attr2"])) { attributes.Add(new SamlAttribute(parameters["attr2"])); } if (!String.IsNullOrEmpty(parameters["attr3"])) { attributes.Add(new SamlAttribute(parameters["attr3"])); } if (attributes.Count == 0) { throw new ServiceProviderUtilityException("No Attributes specified."); } if (!String.IsNullOrEmpty(parameters["attr4"])) { parameters.Add(Saml2Constants.X509SubjectName, Boolean.TrueString); parameters[Saml2Constants.SubjectNameId] = parameters["attr4"]; } queryResponse = serviceProviderUtility.SendAttributeQueryRequest(Context, idpEntityId, parameters, attributes); if (queryResponse.IsEncrypted()) { queryResponse.Decrypt(serviceProviderUtility.ServiceProvider); } } catch (Saml2Exception se) { errorMessage = se.Message; errorTrace = se.StackTrace; if (se.InnerException != null) errorTrace += "
" + se.InnerException.StackTrace; } catch (ServiceProviderUtilityException spue) { errorMessage = spue.Message; errorTrace = spue.StackTrace; if (spue.InnerException != null) errorTrace += "
" + spue.InnerException.StackTrace; } %>

Fedlet Attribute Query Response


<% if (errorMessage != null) { %>

Attribute Query error:

<%=Server.HtmlEncode(errorMessage) %>
<%=Server.HtmlEncode(errorTrace) %>
<% } else { %> <% if (queryResponse.Attributes.Count == 0) { Response.Write("\n"); Response.Write(" \n"); Response.Write("\n"); } else { foreach (string key in queryResponse.Attributes.Keys) { ArrayList values = (ArrayList)queryResponse.Attributes[key]; Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); Response.Write("\n"); } } %>
key value(s)
No attributes found in the response
" + Server.HtmlEncode(key) + "\n"); foreach (string value in values) { Response.Write(Server.HtmlEncode(value) + "
\n"); } Response.Write("
<% if (queryResponse.Attributes.Count == 0) { %>

SAML2 response XML:

<% } %> <% } %>

Return back to try another set of Attributes.