// Path: src/org/owasp/webscarab/model/ConversationID.java
// public class ConversationID implements Comparable<ConversationID> {
//     
//     private static Object _lock = new Object();
//     private static int _next = 1;
//     
//     private int _id;
//     
//     /**
//      * Creates a new instance of ConversationID. Each ConversationID created using this
//      * constructor will be unique (currently based on an incrementing integer value)
//      */
//     public ConversationID() {
//         synchronized(_lock) {
//             _id = _next++;
//         }
//     }
//     
//     public ConversationID(int id) {
//         synchronized (_lock) {
//             _id = id;
//             if (_id >= _next) {
//                 _next = _id + 1;
//             } else if (_id <= 0) {
//                 throw new IllegalArgumentException("Cannot use a negative ConversationID");
//             } 
//         }        
//     }
//     
//     /**
//      * creates a Conversation ID based on the string provided.
//      * The next no-parameter ConversationID created will be "greater" than this one.
//      * @param id a string representation of the ConversationID
//      */    
//     public ConversationID(String id) {
//         this(Integer.parseInt(id.trim()));
//     }
//     
//     /**
//      * resets the ConversationID counter to zero.
//      */    
//     public static void reset() {
//         synchronized(_lock) {
//             _next = 1;
//         }
//     }
//     
//     protected int getID() {
//         return _id;
//     }
//     
//     /**
//      * shows a string representation of the ConversationID
//      * @return a string representation
//      */    
//     public String toString() {
//         return Integer.toString(_id);
//     }
//     
//     /**
//      * compares this ConversationID to another
//      * @param o the other ConversationID to compare to
//      * @return true if they are equal, false otherwise
//      */    
//     public boolean equals(Object o) {
//         if (o == null || ! (o instanceof ConversationID)) return false;
//         return _id == ((ConversationID)o).getID();
//     }
//     
//     /**
//      *
//      * @return
//      */    
//     public int hashCode() {
//         return _id;
//     }
//     
//     /**
//      * compares this ConversationID to another
//      * @param o the other ConversationID to compare to
//      * @return -1, 0 or 1 if this ConversationID is less than, equal to, or greater than the supplied parameter
//      */    
//     public int compareTo(ConversationID o) {
//         int thatid = o.getID();
//         return _id - thatid;
//     }
//     
// }


import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import org.owasp.webscarab.model.ConversationID;
import org.owasp.webscarab.plugin.saml.SamlProxy;
/***********************************************************************
 *
 * $CVSHeader$
 *
 * This file is part of WebScarab, an Open Web Application Security
 * Project utility. For details, please see http://www.owasp.org/
 *
 * Copyright (c) 2010 FedICT
 * Copyright (c) 2010 Frank Cornelis <info@frankcornelis.be>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Getting Source
 * ==============
 *
 * Source for this application is maintained at Sourceforge.net, a
 * repository for free software projects.
 *
 * For details, please see http://www.sourceforge.net/projects/owasp
 *
 */
package org.owasp.webscarab.plugin.saml.swing;


/**
 *
 * @author Frank Cornelis
 */
public final class SamlReplayConversationAction extends AbstractAction {

    private final SamlProxy samlProxy;

    public SamlReplayConversationAction(SamlProxy samlProxy) {
        this.samlProxy = samlProxy;
        putValue(NAME, "Use for replay attack");
        putValue(SHORT_DESCRIPTION, "Use this SAML Response for replay attack");
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        Object o = getValue("SAML-RESPONSE");
// Path: src/org/owasp/webscarab/model/ConversationID.java
// public class ConversationID implements Comparable<ConversationID> {
//     
//     private static Object _lock = new Object();
//     private static int _next = 1;
//     
//     private int _id;
//     
//     /**
//      * Creates a new instance of ConversationID. Each ConversationID created using this
//      * constructor will be unique (currently based on an incrementing integer value)
//      */
//     public ConversationID() {
//         synchronized(_lock) {
//             _id = _next++;
//         }
//     }
//     
//     public ConversationID(int id) {
//         synchronized (_lock) {
//             _id = id;
//             if (_id >= _next) {
//                 _next = _id + 1;
//             } else if (_id <= 0) {
//                 throw new IllegalArgumentException("Cannot use a negative ConversationID");
//             } 
//         }        
//     }
//     
//     /**
//      * creates a Conversation ID based on the string provided.
//      * The next no-parameter ConversationID created will be "greater" than this one.
//      * @param id a string representation of the ConversationID
//      */    
//     public ConversationID(String id) {
//         this(Integer.parseInt(id.trim()));
//     }
//     
//     /**
//      * resets the ConversationID counter to zero.
//      */    
//     public static void reset() {
//         synchronized(_lock) {
//             _next = 1;
//         }
//     }
//     
//     protected int getID() {
//         return _id;
//     }
//     
//     /**
//      * shows a string representation of the ConversationID
//      * @return a string representation
//      */    
//     public String toString() {
//         return Integer.toString(_id);
//     }
//     
//     /**
//      * compares this ConversationID to another
//      * @param o the other ConversationID to compare to
//      * @return true if they are equal, false otherwise
//      */    
//     public boolean equals(Object o) {
//         if (o == null || ! (o instanceof ConversationID)) return false;
//         return _id == ((ConversationID)o).getID();
//     }
//     
//     /**
//      *
//      * @return
//      */    
//     public int hashCode() {
//         return _id;
//     }
//     
//     /**
//      * compares this ConversationID to another
//      * @param o the other ConversationID to compare to
//      * @return -1, 0 or 1 if this ConversationID is less than, equal to, or greater than the supplied parameter
//      */    
//     public int compareTo(ConversationID o) {
//         int thatid = o.getID();
//         return _id - thatid;
//     }
//     
// }


// Path: src/org/owasp/webscarab/plugin/saml/swing/SamlReplayConversationAction.java
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import org.owasp.webscarab.model.ConversationID;
import org.owasp.webscarab.plugin.saml.SamlProxy;

/***********************************************************************
 *
 * $CVSHeader$
 *
 * This file is part of WebScarab, an Open Web Application Security
 * Project utility. For details, please see http://www.owasp.org/
 *
 * Copyright (c) 2010 FedICT
 * Copyright (c) 2010 Frank Cornelis <info@frankcornelis.be>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * Getting Source
 * ==============
 *
 * Source for this application is maintained at Sourceforge.net, a
 * repository for free software projects.
 *
 * For details, please see http://www.sourceforge.net/projects/owasp
 *
 */
package org.owasp.webscarab.plugin.saml.swing;


/**
 *
 * @author Frank Cornelis
 */
public final class SamlReplayConversationAction extends AbstractAction {

    private final SamlProxy samlProxy;

    public SamlReplayConversationAction(SamlProxy samlProxy) {
        this.samlProxy = samlProxy;
        putValue(NAME, "Use for replay attack");
        putValue(SHORT_DESCRIPTION, "Use this SAML Response for replay attack");
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        Object o = getValue("SAML-RESPONSE");
        if (o == null || !(o instanceof ConversationID)) {