use of javax.security.auth.callback.LanguageCallback in project OpenAM by OpenRock.
the class AuthXMLUtils method getXMLForCallbacks.
/**
* TODO-JAVADOC
*/
public static String getXMLForCallbacks(Callback[] callbacks) {
if (callbacks == null) {
return ("");
}
// Construct the xml string
StringBuilder xmlString = new StringBuilder();
xmlString.append(AuthXMLTags.CALLBACKS_BEGIN).append(AuthXMLTags.SPACE).append(AuthXMLTags.LENGTH).append(AuthXMLTags.EQUAL).append(AuthXMLTags.QUOTE).append(callbacks.length).append(AuthXMLTags.QUOTE).append(AuthXMLTags.ELEMENT_END);
for (int i = 0; i < callbacks.length; i++) {
if (callbacks[i] instanceof HiddenValueCallback) {
HiddenValueCallback hiddenValueCallback = (HiddenValueCallback) callbacks[i];
xmlString.append(getHiddenValueCallbackXML(hiddenValueCallback));
} else if (callbacks[i] instanceof NameCallback) {
NameCallback nameCallback = (NameCallback) callbacks[i];
xmlString.append(getNameCallbackXML(nameCallback));
} else if (callbacks[i] instanceof PasswordCallback) {
PasswordCallback passwordCallback = (PasswordCallback) callbacks[i];
xmlString.append(getPasswordCallbackXML(passwordCallback));
} else if (callbacks[i] instanceof ChoiceCallback) {
ChoiceCallback choiceCallback = (ChoiceCallback) callbacks[i];
xmlString.append(getChoiceCallbackXML(choiceCallback));
} else if (callbacks[i] instanceof ConfirmationCallback) {
ConfirmationCallback conCallback = (ConfirmationCallback) callbacks[i];
xmlString.append(getConfirmationCallbackXML(conCallback));
} else if (callbacks[i] instanceof TextInputCallback) {
TextInputCallback textInputCallback = (TextInputCallback) callbacks[i];
xmlString.append(getTextInputCallbackXML(textInputCallback));
} else if (callbacks[i] instanceof TextOutputCallback) {
TextOutputCallback textOutputCallback = (TextOutputCallback) callbacks[i];
xmlString.append(getTextOutputCallbackXML(textOutputCallback));
} else if (callbacks[i] instanceof PagePropertiesCallback) {
PagePropertiesCallback pagePCallback = (PagePropertiesCallback) callbacks[i];
xmlString.append(getPagePropertiesCallbackXML(pagePCallback));
} else if (callbacks[i] instanceof LanguageCallback) {
LanguageCallback lc = (LanguageCallback) callbacks[i];
xmlString.append(getLanguageCallbackXML(lc));
} else if (callbacks[i] instanceof X509CertificateCallback) {
X509CertificateCallback xc = (X509CertificateCallback) callbacks[i];
xmlString.append(getX509CertificateCallbackXML(xc));
} else if (callbacks[i] instanceof HttpCallback) {
HttpCallback hc = (HttpCallback) callbacks[i];
xmlString.append(getHttpCallbackXML(hc));
} else if (callbacks[i] instanceof DSAMECallbackInterface) {
DSAMECallbackInterface dsameCallback = (DSAMECallbackInterface) callbacks[i];
xmlString.append(getCustomCallbackXML(dsameCallback));
} else if (callbacks[i] instanceof RedirectCallback) {
RedirectCallback redirectCallback = (RedirectCallback) callbacks[i];
xmlString.append(getRedirectCallbackXML(redirectCallback));
} else {
AuthenticationCallbackXMLHelper callbackXMLHelper = AuthenticationCallbackXMLHelperFactory.getCallbackXMLHelper();
if (callbackXMLHelper != null) {
xmlString.append(callbackXMLHelper.getAuthenticationCallbackXML(callbacks[i]));
}
}
}
xmlString.append(AuthXMLTags.CALLBACKS_END);
return (xmlString.toString());
}
Aggregations