Package net.virtalabs.auth.mod.auth

Source Code of net.virtalabs.auth.mod.auth.Auth

package net.virtalabs.auth.mod.auth;

import net.virtalabs.auth.StdRx;
import net.virtalabs.auth.exceptions.AppException;
import net.virtalabs.auth.mod.auth.google.GoogleAuthStruct;
import net.virtalabs.auth.mod.auth.self.SelfAuthStruct;
import net.virtalabs.auth.utils.C;

public class Auth {
  public static String run(String rawData) throws AppException{
    //internal routing
    AuthStruct appData = (AuthStruct) StdRx.read(rawData, AuthStruct.class);
    String provider = appData.getProvider();
    if(provider.equals("self")){
      SelfAuthStruct modData = (SelfAuthStruct) StdRx.read(rawData, SelfAuthStruct.class);
      return net.virtalabs.auth.mod.auth.self.SelfAuth.run(modData);
    } else if(provider.equals("google")){
      GoogleAuthStruct modData = (GoogleAuthStruct) StdRx.read(rawData, GoogleAuthStruct.class);
      return net.virtalabs.auth.mod.auth.google.GoogleAuth.run(modData);
    } else {
      throw new AppException("Provider unsupported yet",C.NO_SUCH_PROVIDER);
    }
  }
}
TOP

Related Classes of net.virtalabs.auth.mod.auth.Auth

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.