private static boolean tlsMode;
private static String databaseHost;
private static String webLogHost;
+ private static String dsmHost;
public static void main(String[] args) throws Exception {
System.out.println("-----Account SERVER-----");
if (!parseConfiguration(args)) {
Log.e("\nCoAP-server <Port> Database <Address> <Port> TLS-mode <0|1> are required. WebSocketLog-Server <Addres> <Port> is optional.\n"
+ "ex) " + Constants.DEFAULT_COAP_PORT
- + " 127.0.0.1 27017 0\n");
+ + " 127.0.0.1 27017 0 127.0.0.1 8080\n");
return;
}
if (webLogHost != null)
private static boolean parseConfiguration(String[] args) {
// configuration provided by arguments
- if (args.length == 4 || args.length == 6) {
+ if (args.length == 6 || args.length == 8) {
coapServerPort = Integer.parseInt(args[0]);
databaseHost = args[1] + ":" + args[2];
tlsMode = Integer.parseInt(args[3]) == 1;
- if (args.length == 6)
- webLogHost = args[4] + ":" + args[5];
+ dsmHost = args[4] + ":" + args[5];
+ if (args.length == 8)
+ webLogHost = args[6] + ":" + args[7];
return true;
}
// configuration provided by docker env
}
return false;
}
+
+ public static String getDsmHost() {
+ return dsmHost;
+ }
+
}
import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.apache.oltu.oauth2.common.message.types.GrantType;
+import org.iotivity.cloud.accountserver.AccountServer;
import org.iotivity.cloud.accountserver.db.TokenTable;
import org.iotivity.cloud.accountserver.db.UserTable;
import org.iotivity.cloud.base.exception.ServerException.InternalServerErrorException;
private static final String SAMSUNG_PROVIDER_NAME = "Samsung";
private static final String TOKEN = "token";
- private static final String DSM_HOST = "http://localhost:8080";
+ private static String DSM_HOST = "http://" + AccountServer.getDsmHost();
private static final String CLIENT_ID = "client";
private static final String SECRET = "secret";
- private final static String REDIRECT_URL = DSM_HOST + "/dsm/oauth/callback";
- private final static String TOKEN_END_POINT = DSM_HOST + "/dsm/oauth/token";
+ private static String REDIRECT_URL = "http://localhost:8080/dsm/oauth/callback";//Don't change
+ private static String TOKEN_END_POINT = DSM_HOST + "/dsm/oauth/token";
@SuppressWarnings("unused")
- private final static String AUTH_URL = DSM_HOST + "/dsm/oauth";
- private final static String RESOURCE_URL = DSM_HOST + "/dsm/restapi/access_token/";
+ private static String AUTH_URL = DSM_HOST + "/dsm/oauth";
+ private static String RESOURCE_URL = DSM_HOST + "/dsm/restapi/access_token/";
private static final String USER_ID_KEY = "username";
- final static private SecureRandom random = new SecureRandom();
+ private static final SecureRandom random = new SecureRandom();
@Override
public TokenTable requestAccessTokenInfo(String authCode, Object options) {