labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r606880 - in /labs/vysper/src: main/config/ main/java/org/apache/vysper/mina/ main/java/org/apache/vysper/xmpp/applicationdomains/base/handler/ main/java/org/apache/vysper/xmpp/applicationdomains/sasl/handler/ main/java/org/apache/vysper/xm...
Date Wed, 26 Dec 2007 11:16:38 GMT
Author: berndf
Date: Wed Dec 26 03:16:37 2007
New Revision: 606880

URL: http://svn.apache.org/viewvc?rev=606880&view=rev
Log:
[vysper] anonymous authentication

Added:
    labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SASLMechanism.java
Modified:
    labs/vysper/src/main/config/spring-config.xml
    labs/vysper/src/main/java/org/apache/vysper/mina/XmppIoHandlerAdapter.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/base/handler/StreamStartHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/sasl/handler/AuthHandler.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/NamespaceURIs.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java
    labs/vysper/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java
    labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java
    labs/vysper/src/test/java/org/apache/vysper/xmpp/server/response/ServerResponsesTestCase.java

Modified: labs/vysper/src/main/config/spring-config.xml
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/config/spring-config.xml?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/config/spring-config.xml (original)
+++ labs/vysper/src/main/config/spring-config.xml Wed Dec 26 03:16:37 2007
@@ -36,7 +36,12 @@
     <bean id="stanzaRelay" class="org.apache.vysper.xmpp.delivery.RecordingStanzaRelay"
/>
     
     <bean id="serverFeatures" class="org.apache.vysper.xmpp.server.ServerFeatures">
-        <constructor-arg value="true" />        
+        <constructor-arg value="true" />
+        <property name="authenticationMethods">
+            <list>
+                <bean class="org.apache.vysper.xmpp.authorization.Anonymous" />
+            </list>
+        </property>
     </bean>
     
     <bean id="server" class="org.apache.vysper.xmpp.server.DefaultServerRuntimeContext"
>
@@ -53,7 +58,7 @@
             <list>
                 <bean class="org.apache.vysper.xmpp.applicationdomains.base.BaseStreamStanzaDictionary"/>
                 <bean class="org.apache.vysper.xmpp.applicationdomains.starttls.StartTLSStanzaDictionary"/>
-                <!--<bean class="org.apache.vysper.xmpp.applicationdomains.sasl.SASLStanzaDictionary"/>-->
+                <bean class="org.apache.vysper.xmpp.applicationdomains.sasl.SASLStanzaDictionary"/>
             </list>
         </constructor-arg>
         <property name="tlsContextFactory" ref="tlsContextFactory" />

Modified: labs/vysper/src/main/java/org/apache/vysper/mina/XmppIoHandlerAdapter.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/mina/XmppIoHandlerAdapter.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/mina/XmppIoHandlerAdapter.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/mina/XmppIoHandlerAdapter.java Wed Dec 26
03:16:37 2007
@@ -76,7 +76,6 @@
 
     public void messageSent(IoSession ioSession, Object o) throws Exception {
         // TODO implement
-        System.err.println("*** message sent");
     }
 
     public void sessionCreated(IoSession ioSession) throws Exception {

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/base/handler/StreamStartHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/base/handler/StreamStartHandler.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/base/handler/StreamStartHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/base/handler/StreamStartHandler.java
Wed Dec 26 03:16:37 2007
@@ -57,7 +57,8 @@
         if (serverCall) sessionContext.setServerToServer(); else sessionContext.setClientToServer();
 
         if (sessionStateHolder.getState() != SessionState.INITIATED && 
-            sessionStateHolder.getState() != SessionState.ENCRYPTED ) {
+            sessionStateHolder.getState() != SessionState.ENCRYPTED && 
+            sessionStateHolder.getState() != SessionState.AUTHENTICATED) {
             return respondUnsupportedStanzaType("unexpected stream start");
         } 
         
@@ -151,7 +152,15 @@
 
 
         // if all is correct, go to next phase
-        sessionStateHolder.setState(SessionState.STARTED);
+        switch (sessionStateHolder.getState()) {
+
+            case AUTHENTICATED:
+            case ENCRYPTED:
+                // do not change state!
+                break;
+            default:
+                sessionStateHolder.setState(SessionState.STARTED);
+        }
 
         if (responseStanza != null) return new ResponseStanzaContainerImpl(responseStanza);
 

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/sasl/handler/AuthHandler.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/sasl/handler/AuthHandler.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/sasl/handler/AuthHandler.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/applicationdomains/sasl/handler/AuthHandler.java
Wed Dec 26 03:16:37 2007
@@ -28,7 +28,11 @@
 import org.apache.vysper.xmpp.server.response.ServerResponses;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.xmlfragment.XMLElementVerifier;
+import org.apache.vysper.xmpp.xmlfragment.Attribute;
 import org.apache.vysper.xmpp.applicationdomains.sasl.SASLFailureType;
+import org.apache.vysper.xmpp.authorization.SASLMechanism;
+
+import java.util.List;
 
 /**
  */
@@ -54,13 +58,20 @@
             return respondSASLFailure();
         }
 
-        // TODO implement logic below!
-        Stanza responseStanza = new ServerResponses().getTLSProceed();
-
-        // if all is correct, go to next phase
-        sessionStateHolder.setState(SessionState.ENCRYPTION_STARTED);
+        Attribute attribute = stanza.getAttribute("mechanism");
+        String requestedMechanism = attribute.getValue();
+        SASLMechanism identifiedMechanism = null;
+
+        List<SASLMechanism> list = sessionContext.getServerRuntimeContext().getServerFeatures().getAuthenticationMethods();
+        for (SASLMechanism saslMechanism : list) {
+            if (saslMechanism.getName().equals(requestedMechanism)) {
+                identifiedMechanism = saslMechanism;
+                break;
+            }
+        }
+        if (identifiedMechanism == null) throw new RuntimeException("return error");
 
-        sessionContext.switchToTLS();
+        Stanza responseStanza = identifiedMechanism.started(sessionContext, sessionStateHolder);
         
         return new ResponseStanzaContainerImpl(responseStanza);
     }

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java?rev=606880&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java (added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Anonymous.java Wed Dec
26 03:16:37 2007
@@ -0,0 +1,21 @@
+package org.apache.vysper.xmpp.authorization;
+
+import org.apache.vysper.xmpp.protocol.SessionStateHolder;
+import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.server.SessionState;
+import org.apache.vysper.xmpp.server.response.ServerResponses;
+import org.apache.vysper.xmpp.stanza.Stanza;
+
+/**
+ */
+public class Anonymous implements SASLMechanism {
+    public String getName() {
+        return "ANONYMOUS";
+    }
+
+    public Stanza started(SessionContext sessionContext, SessionStateHolder sessionStateHolder)
{
+        sessionStateHolder.setState(SessionState.AUTHENTICATED);
+        return new ServerResponses().getAuthenticationSuccess(); 
+    }
+
+}

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java?rev=606880&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java (added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/Plain.java Wed Dec 26 03:16:37
2007
@@ -0,0 +1,17 @@
+package org.apache.vysper.xmpp.authorization;
+
+import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.protocol.SessionStateHolder;
+import org.apache.vysper.xmpp.stanza.Stanza;
+
+/**
+ */
+public class Plain implements SASLMechanism {
+    public String getName() {
+        return "PLAIN";
+    }
+
+    public Stanza started(SessionContext sessionContext, SessionStateHolder sessionStateHolder)
{
+        throw new RuntimeException("not yet implemented");
+    }
+}

Added: labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SASLMechanism.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SASLMechanism.java?rev=606880&view=auto
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SASLMechanism.java (added)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/authorization/SASLMechanism.java Wed
Dec 26 03:16:37 2007
@@ -0,0 +1,16 @@
+package org.apache.vysper.xmpp.authorization;
+
+import org.apache.vysper.xmpp.protocol.SessionStateHolder;
+import org.apache.vysper.xmpp.server.SessionContext;
+import org.apache.vysper.xmpp.stanza.Stanza;
+
+/**
+ * describes a SASL mechanism
+ */
+public interface SASLMechanism {
+    
+    String getName();
+    
+    Stanza started(SessionContext sessionContext, SessionStateHolder sessionStateHolder);
+    
+}

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/NamespaceURIs.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/NamespaceURIs.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/NamespaceURIs.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/NamespaceURIs.java Wed Dec 26
03:16:37 2007
@@ -22,6 +22,7 @@
  */
 public class NamespaceURIs {
     public static final String HTTP_ETHERX_JABBER_ORG_STREAMS = "http://etherx.jabber.org/streams";
+    public static final String URN_IETF_PARAMS_XML_NS_XMPP_BIND = "urn:ietf:params:xml:ns:xmpp-bind";
     public static final String URN_IETF_PARAMS_XML_NS_XMPP_TLS = "urn:ietf:params:xml:ns:xmpp-tls";
     public static final String URN_IETF_PARAMS_XML_NS_XMPP_SASL = "urn:ietf:params:xml:ns:xmpp-sasl";
     public static final String URN_IETF_PARAMS_XML_NS_XMPP_STREAMS = "urn:ietf:params:xml:ns:xmpp-streams";

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/SessionStateHolder.java Wed
Dec 26 03:16:37 2007
@@ -32,5 +32,6 @@
 
     public void setState(SessionState newState) {
         currentState = newState;
+        System.err.println("session state changed to = " + newState);
     }
 }

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/AuthenticatedProtocolWorker.java
Wed Dec 26 03:16:37 2007
@@ -17,11 +17,23 @@
 
 package org.apache.vysper.xmpp.protocol.worker;
 
+import org.apache.vysper.xmpp.applicationdomains.base.handler.StreamStartHandler;
+import org.apache.vysper.xmpp.protocol.ResponseWriter;
+import org.apache.vysper.xmpp.protocol.SessionStateHolder;
+import org.apache.vysper.xmpp.protocol.StanzaHandler;
+import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.SessionState;
+import org.apache.vysper.xmpp.stanza.Stanza;
 
 /**
  */
 public class AuthenticatedProtocolWorker extends AbstractStateAwareProtocolWorker {
+
+    protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder,
Stanza stanza, StanzaHandler stanzaHandler, ResponseWriter responseWriter) {
+        if (stanzaHandler instanceof StreamStartHandler) return true;
+        responseWriter.writeStreamNotOpenedError(sessionContext);
+        return false;
+    }
 
     public SessionState getHandledState() {
         return SessionState.AUTHENTICATED;

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/protocol/worker/EncryptedProtocolWorker.java
Wed Dec 26 03:16:37 2007
@@ -17,13 +17,14 @@
 
 package org.apache.vysper.xmpp.protocol.worker;
 
+import org.apache.vysper.xmpp.applicationdomains.base.handler.StreamStartHandler;
+import org.apache.vysper.xmpp.applicationdomains.sasl.handler.AuthHandler;
 import org.apache.vysper.xmpp.protocol.ResponseWriter;
 import org.apache.vysper.xmpp.protocol.SessionStateHolder;
 import org.apache.vysper.xmpp.protocol.StanzaHandler;
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.SessionState;
 import org.apache.vysper.xmpp.stanza.Stanza;
-import org.apache.vysper.xmpp.applicationdomains.base.handler.StreamStartHandler;
 
 /**
  */
@@ -35,6 +36,7 @@
 
     protected boolean checkState(SessionContext sessionContext, SessionStateHolder sessionStateHolder,
Stanza stanza, StanzaHandler stanzaHandler, ResponseWriter responseWriter) {
         if (stanzaHandler instanceof StreamStartHandler) return true;
+        if (stanzaHandler instanceof AuthHandler) return true;
         responseWriter.writeStreamNotOpenedError(sessionContext);
         return false;
     }

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java (original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/server/ServerFeatures.java Wed Dec 26
03:16:37 2007
@@ -16,8 +16,11 @@
  ***********************************************************************/
 package org.apache.vysper.xmpp.server;
 
-import java.util.List;
+import org.apache.vysper.xmpp.authorization.SASLMechanism;
+
 import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
 
 /**
  * switch configuration of optional server features 
@@ -25,7 +28,7 @@
 public class ServerFeatures {
 
     private boolean startTLSRequired = true;
-    private List<String> authenticationMethods = new ArrayList<String>();
+    private final List<SASLMechanism> authenticationMethods = new ArrayList<SASLMechanism>();
 
     public ServerFeatures() {
         // default constructor
@@ -37,5 +40,17 @@
 
     public boolean isStartTLSRequired() {
         return startTLSRequired;
+    }
+
+    public void setStartTLSRequired(boolean startTLSRequired) {
+        this.startTLSRequired = startTLSRequired;
+    }
+
+    public void setAuthenticationMethods(List<SASLMechanism> authenticationMethods)
{
+        this.authenticationMethods.addAll(authenticationMethods);
+    }
+
+    public List<SASLMechanism> getAuthenticationMethods() {
+        return Collections.unmodifiableList(authenticationMethods);
     }
 }

Modified: labs/vysper/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java
(original)
+++ labs/vysper/src/main/java/org/apache/vysper/xmpp/server/response/ServerResponses.java
Wed Dec 26 03:16:37 2007
@@ -24,6 +24,9 @@
 import org.apache.vysper.xmpp.server.SessionContext;
 import org.apache.vysper.xmpp.server.SessionState;
 import org.apache.vysper.xmpp.addressing.Entity;
+import org.apache.vysper.xmpp.authorization.SASLMechanism;
+
+import java.util.List;
 
 /**
  */
@@ -36,8 +39,13 @@
     public Stanza getStreamOpener(boolean forClient, Entity from, XMPPVersion version, SessionContext
sessionContext) {
         Stanza innerFeatureStanza;
         if (sessionContext.getState() == SessionState.INITIATED) innerFeatureStanza = getFeaturesForEncryption(sessionContext);
-        else if (sessionContext.getState() == SessionState.ENCRYPTED) innerFeatureStanza
= getFeaturesForAuthentication(); 
-        else throw new IllegalStateException("unsupported state for responding with stream
opener"); 
+        else if (sessionContext.getState() == SessionState.ENCRYPTED) innerFeatureStanza
= getFeaturesForAuthentication(sessionContext.getServerRuntimeContext().getServerFeatures().getAuthenticationMethods());

+        else if (sessionContext.getState() == SessionState.AUTHENTICATED) {
+            sessionContext.setIsReopeningXMLStream();
+            innerFeatureStanza = getFeaturesForSession();
+        } else {
+            throw new IllegalStateException("unsupported state for responding with stream
opener");
+        } 
         
         StanzaBuilder stanzaBuilder = getStreamOpener(forClient, from, sessionContext.getXMLLang(),
version, sessionContext.getSessionId(), innerFeatureStanza);
         
@@ -72,19 +80,30 @@
         return stanzaBuilder.getFinalStanza();
     }
 
-    public Stanza getFeaturesForAuthentication() {
+    public Stanza getFeaturesForAuthentication(List<SASLMechanism> authenticationMethods)
{
 
         StanzaBuilder stanzaBuilder = new StanzaBuilder("features");
 
         stanzaBuilder.startInnerElement("mechanisms")
-            .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL)
-            .startInnerElement("mechanism").addText("ANONYMOUS").endInnerElement()
-            .startInnerElement("mechanism").addText("EXTERNAL").endInnerElement()
-            .startInnerElement("mechanism").addText("DIGEST-MD5").endInnerElement()
-            .startInnerElement("mechanism").addText("PLAIN").endInnerElement()
-            .startInnerElement("mechanism").addText("KERBEROS_V4").endInnerElement()
-            .endInnerElement();
+            .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
+            for (SASLMechanism authenticationMethod : authenticationMethods) {
+                stanzaBuilder.startInnerElement("mechanism").addText(authenticationMethod.getName()).endInnerElement();
+            }
+            stanzaBuilder.endInnerElement();
+
+        return stanzaBuilder.getFinalStanza();
+    }
+
+    private Stanza getFeaturesForSession() {
+        StanzaBuilder stanzaBuilder = new StanzaBuilder("features");
+
+        stanzaBuilder.startInnerElement("bind")
+            .addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_BIND)
+            .startInnerElement("required").endInnerElement();
+        stanzaBuilder.endInnerElement();
 
+        // TODO get more features
+        
         return stanzaBuilder.getFinalStanza();
     }
 
@@ -95,4 +114,9 @@
         return stanzaBuilder.getFinalStanza();
     }
 
+    public Stanza getAuthenticationSuccess() {
+        StanzaBuilder stanzaBuilder = new StanzaBuilder("success");
+        stanzaBuilder.addNamespaceAttribute(NamespaceURIs.URN_IETF_PARAMS_XML_NS_XMPP_SASL);
+        return stanzaBuilder.getFinalStanza();
+    }
 }

Modified: labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java (original)
+++ labs/vysper/src/test/java/org/apache/vysper/smack/BasicClient.java Wed Dec 26 03:16:37
2007
@@ -41,7 +41,9 @@
             SASLAuthentication saslAuthentication = connection.getSASLAuthentication();
             saslAuthentication.authenticateAnonymously();
 
-            connection.login("vysperuser", "mypass");
+            if (!saslAuthentication.isAuthenticated()) return;
+            
+            //connection.login("vysperuser", "mypass");
             // Chat chat = connection.getChatManager().createChat("vysper@apache.org", new
MessageListener() {
             //    public void processMessage(Chat chat, Message message) { 
             //        System.out.println("log received message: " + message); } 

Modified: labs/vysper/src/test/java/org/apache/vysper/xmpp/server/response/ServerResponsesTestCase.java
URL: http://svn.apache.org/viewvc/labs/vysper/src/test/java/org/apache/vysper/xmpp/server/response/ServerResponsesTestCase.java?rev=606880&r1=606879&r2=606880&view=diff
==============================================================================
--- labs/vysper/src/test/java/org/apache/vysper/xmpp/server/response/ServerResponsesTestCase.java
(original)
+++ labs/vysper/src/test/java/org/apache/vysper/xmpp/server/response/ServerResponsesTestCase.java
Wed Dec 26 03:16:37 2007
@@ -20,8 +20,13 @@
 import org.apache.vysper.xmpp.parser.ParsingException;
 import org.apache.vysper.xmpp.stanza.Stanza;
 import org.apache.vysper.xmpp.parser.StringStreamParser;
+import org.apache.vysper.xmpp.authorization.SASLMechanism;
+import org.apache.vysper.xmpp.authorization.Anonymous;
 import junit.framework.TestCase;
 
+import java.util.List;
+import java.util.ArrayList;
+
 /**
  */
 public class ServerResponsesTestCase extends TestCase {
@@ -39,7 +44,10 @@
 
         Stanza stanza = parser.getNextStanza();
 
-        // TODO use verifier to do this
-       assertEquals("stanzas are identical", stanza, new ServerResponses().getFeaturesForAuthentication());
+
+        List<SASLMechanism> mechanismList = new ArrayList<SASLMechanism>();
+        mechanismList.add(new Anonymous());
+        // add others
+        assertEquals("stanzas are identical", stanza.toString(), new ServerResponses().getFeaturesForAuthentication(mechanismList).toString());
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message