Results 1 to 2 of 2

Thread: Multiple Authentication

Hybrid View

  1. #1
    Join Date
    Jul 2010
    Posts
    4

    Default Multiple Authentication

    I'm looking to extend the server and having two types of user authentication in the same application.
    Code:
    public abstract class Authentication extends ModuleBase {
       public final void onAppStart(IApplicationInstance appInstance) {
          try {
             DatabaseConnection.getInstance().getConnection().close();
          } catch (Exception e) {
             getLogger().fatal("Unable to create Database Pool " + e.toString());	
          }
       }
       
       public abstract void onConnect(IClient client, RequestFunction function,
    			AMFDataList params);
    }
    
    public class HostAuthentication extends Authentication {
    
       public void onConnect(IClient client, RequestFunction function, 
                           AMFDataList params) {
          //Concrete implementation to ensure host is valid and able to stream
       }
    }
    
    public class ViewerAuthentication extends Authentication {
       public void onConnect(IClient client, RequestFunction function,
                           AMFDataList params) {
          //Concrete implementation to ensure viewer is valid and host created
          //the stream
       }
    }
    }

    The problem I am running into is that regardless of which location I set the modules up in the application.xml, I am receiving logs that each of the onConnect methods is running. Is there any way to prevent this from occurring?

    Code:
    			
    <Module>
       <Name>host_authentication</Name>
       <Description>Verifies host able to create stream</Description>
       <Class>com.testing.HostAuthentication</Class>
    </Module>
    <Module>
       <Name>viewer_authentication</Name>
       <Description>Verifies viewer</Description>
       <Class>com.testing.ViewerAuthentication</Class>
    </Module>
    I had hoped that it was like the custom methods which implicitly require you to call this.invokePrevious, but that doesn't seem to be the case. Is there any way around this?

    I want to have a host authenticate to the server to create their live webstream, and once they have created the stream, then I can run my logic for the viewers of the stream to ensure they are from a valid location.

    Feasible?

  2. #2

    Default

    You will have to find some other way to separate these connections. If you read the User's Guide section regarding extending the server with Java it explains how the event methods such as onConnect, onAppStart... are called for all modules.

    Charlie

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •