AuthXMLUtils.java revision f0e56106ee05e35ce4aa00ba4f47ba1789341ec7
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 Sun Microsystems 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
* 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 opensso/legal/CDDLv1.0.txt.
* 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]"
*
* $Id: AuthXMLUtils.java,v 1.10 2009/06/19 20:39:09 qcheng Exp $
*
* Portions Copyrighted 2010-2015 ForgeRock AS.
*/
public class AuthXMLUtils {
/**
* TODO-JAVADOC
*/
try {
} catch (Exception e) {
return null;
}
}
/**
* TODO-JAVADOC
*/
public static Callback[] getCallbacks(
boolean noFilter,
if (callbackNode == null) {
return (null);
}
// Get the length attribute and construct the callbacks
if (debug.messageEnabled()) {
}
}
}
// Get the child nodes and construct the callbacks
if (childNodes == null) {
return null;
}
// following indexes are to keep track of order of
// callback in the callback array.
int nameIndex=0;
int passIndex=0;
int ccIndex=0;
int concIndex=0;
int tiIndex=0;
int toIndex=0;
int lcIndex=0;
int ppIndex=0;
int diIndex=0;
int authCallbackIndex=0;
if (nameIndex >= 0){
}
} else {
}
if (nameIndex >= 0){
}
} else {
}
if (passIndex >= 0) {
}
} else {
}
if (ccIndex >= 0) {
}
} else {
}
if (concIndex >= 0) {
}
} else {
}
if ( tiIndex >= 0) {
}
} else {
}
if ( toIndex >= 0) {
}
} else {
}
} else if (
&& noFilter
) {
if ( ppIndex >= 0) {
}
} else {
null));
}
if (lcIndex >= 0) {
}
} else {
}
if (callbackXMLHelper != null) {
if (authCallbackIndex >= 0) {
}
} else {
}
}
} else if (childNodeName.equals(
lcIndex =
if (lcIndex >= 0) {
}
} else {
}
} else if (childNodeName.equals(
if (diIndex >= 0) {
}
} else {
}
if ( diIndex >= 0) {
}
} else {
}
if ( diIndex >= 0) {
}
} else {
}
}
}
}
/**
* Returns the remote HttpServletRequest object from the embedded serialized
* content in the XML document
*
* @param requestNode The request xml node
* @return The Http Servlet Request object
*/
if (requestNode == null)
return null;
try {
} catch (IOException ioe) {
} catch (ClassNotFoundException cnfe) {
}
return (HttpServletRequest) obj;
}
/**
* Returns the remote HttpServletResponse object from the embedded serialized
* content in the XML document
*
* @param responseNode The response xml node
* @return The Http Servlet Response object
*/
if (responseNode == null)
return null;
try {
} catch (IOException ioe) {
} catch (ClassNotFoundException cnfe) {
}
return (HttpServletResponse) obj;
}
/**
* TODO-JAVADOC
*/
return ("");
}
// Construct the xml string
if (callbacks[i] instanceof HiddenValueCallback) {
} else if (callbacks[i] instanceof NameCallback) {
} else if (callbacks[i] instanceof PasswordCallback) {
(PasswordCallback) callbacks[i];
} else if (callbacks[i] instanceof ChoiceCallback) {
} else if (callbacks[i] instanceof ConfirmationCallback) {
} else if (callbacks[i] instanceof TextInputCallback) {
(TextInputCallback) callbacks[i];
} else if (callbacks[i] instanceof TextOutputCallback) {
} else if (callbacks[i] instanceof PagePropertiesCallback) {
=(PagePropertiesCallback) callbacks[i];
} else if (callbacks[i] instanceof LanguageCallback) {
} else if (callbacks[i] instanceof X509CertificateCallback) {
} else if (callbacks[i] instanceof HttpCallback) {
} else if (callbacks[i] instanceof DSAMECallbackInterface) {
} else if (callbacks[i] instanceof RedirectCallback) {
(RedirectCallback) callbacks[i];
} else {
if (callbackXMLHelper != null) {
callbacks[i]));
}
}
}
}
if (callback instanceof NameCallback) {
}
}
if (nameCallback == null) {
if (defaultValue == null) {
} else {
}
}
if (debug.messageEnabled()) {
}
}
return nameCallback;
}
if (callback instanceof HiddenValueCallback) {
}
if (hiddenValueCallback == null) {
if (defaultValue == null) {
} else {
}
}
if (debug.messageEnabled()) {
}
}
return hiddenValueCallback;
}
boolean echoPassword = false;
if ((echoPasswordAttr != null) &&
echoPassword = true;
}
if (callback instanceof PasswordCallback) {
}
}
if (passwordCallback == null) {
}
/** if (debug.messageEnabled()) {
* debug.message("Value is : " + value);
*}
*/
}
return passwordCallback;
}
static ChoiceCallback createChoiceCallback(
if (callback instanceof ChoiceCallback) {
}
}
if (choiceCallback == null) {
boolean multiSelect = false;
if ((multiSelectAttr != null) &&
multiSelect = true;
}
int defaultChoice = 0;
if ((isDefaultAttr != null) &&
defaultChoice = j;
}
choices[j] = choiceValue;
}
}
int[] selectedIndexes;
if ( selectedNode != null ) {
selectedIndexes[j] =
}
if (choiceCallback.allowMultipleSelections()) {
} else {
}
}
return choiceCallback;
}
if (callback instanceof ConfirmationCallback) {
}
}
if (conCallback == null) {
int messageType = 0;
}
boolean bOptions = false;
int optionType = 0;
bOptions = true;
}
}
if ( optionsNode != null ) {
options[j] = optionValue;
}
}
if ( bOptions ) {
} else {
}
} else {
if ( bOptions ) {
} else {
conCallback = new ConfirmationCallback(
}
}
}
if ( selectedNode != null ) {
}
return conCallback;
}
if (callback instanceof TextInputCallback) {
}
}
if (textInputCallback == null) {
if (defaultValue == null) {
} else {
}
}
}
return textInputCallback;
}
if (callback instanceof TextOutputCallback) {
}
}
if (textOutputCallback == null) {
int messageType = 0;
} else {
}
}
}
return textOutputCallback;
}
if (callback instanceof PagePropertiesCallback) {
}
}
if (pagePropertiesCallback == null) {
boolean errState = false;
errState = true;
}
}
return pagePropertiesCallback;
}
if (callback instanceof X509CertificateCallback) {
}
}
if (certCallback == null) {
}
boolean signReq = true;
signReq = false;
}
if (certificate != null) {
/*
* use the base64 decoder from MimeUtility instead of
* writing our own
*/
try {
} catch (CertificateException e) {
}
}
}
return certCallback;
}
if (callback instanceof RedirectCallback) {
}
}
if (redirectCallback == null) {
if (debug.messageEnabled()) {
" redirectMethod=" + redirectMethod +
" redirectData=" + redirectData +
" statusParam=" + statusParam +
" redirectBackUrlCookie = " + redirectBackUrlCookie);
}
}
}
return redirectCallback;
}
}
}
}
return hc;
}
}
return (null);
}
while (dataNodesIterator.hasNext()) {
}
return nameValuePairs;
}
}
return (null);
}
}
return (null);
}
}
return (null);
}
}
return (null);
}
}
return (null);
}
if (defaultName != null) {
}
}
}
if (defaultValue != null) {
}
}
}
if ( passwordCallback.isEchoOn() ) {
} else {
}
}
}
if (choiceCallback.allowMultipleSelections() ) {
} else {
}
if ( j == checked ) {
.append("yes")
}
}
}
if ( selectIndexes != null ) {
}
}
}
switch(conCallback.getMessageType()) {
break;
case ConfirmationCallback.ERROR:
break;
case ConfirmationCallback.WARNING:
}
switch(conCallback.getOptionType()) {
break;
break;
break;
}
conCallback.getPrompt()))
}
}
}
}
if (defaultText != null) {
}
}
}
static String getTextOutputCallbackXML(
switch(textOutputCallback.getMessageType()) {
break;
case TextOutputCallback.ERROR:
break;
case TextOutputCallback.WARNING:
}
}
static String getPagePropertiesCallbackXML(
if ( pagePCallback.getErrorState() ) {
} else {
}
}
}
}
}
int from = 0;
int idx;
}
return ret;
}
static String getX509CertificateCallbackXML(
try {
} catch (CertificateEncodingException e) {
}
}
}
append(":").
}
}
static String getRedirectCallbackXML(
// <RedirectCallback>
if (redirectMethod != null) {
} else {
}
// <RedirectUrl>
// <RedirectData>
if (redirectData != null) {
}
}
// <RedirectStatusParam>
if (redirectParam != null) {
}
// <RedirectBackUrlCookie>
if (redirectBackUrlCookie != null) {
}
// <Status>
}
if (debug.messageEnabled()) {
}
}
}
return (null);
}
}
return null;
}
}
return (null);
}
}
return (null);
}
}
return (null);
}
try {
if (customCallback != null) {
if (customCallback instanceof DSAMECallbackInterface) {
if (debug.messageEnabled()) {
}
}
}
}
}
}
}
// get the values
if (debug.messageEnabled()) {
+ localName);
}
}
}
}
}
if (debug.messageEnabled()) {
}
return callback;
} catch (Exception e) {
return null;
}
}
try {
if (debug.messageEnabled()) {
}
// get the map from the custom callabck and loop trhu to
// to add attribute and value
if (debug.messageEnabled()) {
}
if (debug.messageEnabled()) {
}
if (debug.messageEnabled()) {
}
if (debug.messageEnabled()) {
}
}
}
} catch (Exception e) {
return null;
}
}
/**
* Serialize the subject.
*
* @param subject Subject to be serialized.
* @return serialized subject.
*/
byte[] sSerialized = null ;
try{
byteOut = new ByteArrayOutputStream();
//convert object to byte using streams
// base 64 encoding & encrypt
if (debug.messageEnabled()) {
}
}catch (Exception e){
}
return encodedString;
}
/**
* Deserializes Subject.
*
* @param subjectSerialized Serialized Subject.
* @throws Exception
*/
throws Exception {
// decrypt and then decode
new DecodeAction(subjectSerialized));
byte byteDecrypted[];
try{
//convert byte to object using streams
}catch(Exception e){
}
if (debug.messageEnabled()) {
}
return subjectObj;
}
/**
* Serialize an object to a string
*
* @param object The object to be serialized
* @return Base64 encoded string representation of the object
* @throws IOException If the object is not serializable
*/
throws IOException {
}
/**
* Deserialize a string back into the original object
*
* @param encObj The Base64 encoded string representation of the object
* @return The deserialized object
* @throws IOException If the object cannot be deserialized
* @throws ClassNotFoundException If the class representing the object
* cannot be found
*/
throws IOException, ClassNotFoundException {
}
return obj;
}
int i=0;
if (callbacks[i] instanceof NameCallback) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof PasswordCallback) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof ConfirmationCallback) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof ChoiceCallback) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof TextInputCallback) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof TextOutputCallback) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof PagePropertiesCallback) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof DSAMECallbackInterface) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof LanguageCallback) {
return i;
}
}
return -1;
}
static int getX509CertificateCallbackIndex(
int i=0;
if (callbacks[i] instanceof X509CertificateCallback) {
return i;
}
}
return -1;
}
int i=0;
if (callbacks[i] instanceof HttpCallback) {
return i;
}
}
return -1;
}
int i = 0;
if (callbacks[i] instanceof RedirectCallback) {
return i;
}
}
return -1;
}
if (callback instanceof LanguageCallback) {
}
}
if (languageCallback == null) {
languageCallback= new LanguageCallback();
}
if (debug.messageEnabled()) {
}
} else {
}
}
return languageCallback;
}
}
}
}
}
if (debug.messageEnabled()) {
}
}
/**
* returns the value of DefaultValue Node
*/
if (defaultNode != null) {
}
return defaultValue;
}
}