dhulipudi / webextest

test
0 stars 0 forks source link

Test #1

Open dhulipudi opened 1 year ago

dhulipudi commented 1 year ago

Request https://webexapis.com/v1/meetings/join

{ "joinDirectly": false, "meetingNumber": "23459549725" }

----------------------- Response -----------------

{ "startLink": "https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAYFrojWolTmo%2FrFb7Ca8SaWwKmmXPv%2B0SASLubyTuXlHfB%2BnNwLM7ITGqOzqJNjFjqhd%2F3MlFhY6kE4RlUBShn7wiZCCnleHZ7cNSY1%2BEWxngiCpOldGtJml4erfScyCIeAWDwAD%2BVMTPgazJZMdpEQ93iNt32NnMernsBRr1EdGh9bEli0lXofUT%2FfOJ17Tm7U4n5vIOehK7coy81V7qe9jJgbqePlyeH63lYEPxrTPSGjPY92%2BIW0%2BQkXF3ekEFUSmt3q9%2FUTfwvtu%2BAZN893&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAZkP%2BbCrHpejysVbG2pSnrjCYDOwHQEa92ykgDf5cOi9loMlaued2p2Z39Ep%2FlZ2YoH1gTNxP9e2zdvMGKtxrZxaoQ734SNVu5OVsCpswykzoM%2FT0v5h2IyBf3Mzm9VZ%2Bc%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D", "joinLink": "https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAYxvNT1JAt8bBXdMNPTR27TBguXYPKUOlSUzMJsaX2LQP4EEdAfPXV4cIJteyOt%2BAlGlEv6BYLJMUK6GI9hNmj8cl6dr8skEOxM%2B%2BaLle08PTcChox0iNRy4MMnCM2u1fUNZSSbg4gKOfWpjQTN203xdfyOj74Aqv9vlk%2Bzl9NMcp0udJb1JztYuqDQMLGUasYnj%2FOY2He1kP%2FNyyBEShuzArxRVZa083%2Btmb61tYXIeihskYXcoAg9pt28Kk%2FqghqrTH3jh2oaaURdFtVVje8W&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAZGffq965NXI0%2FT%2FZ7xy27ov5gq4cVg%2FxrRvmgvFv%2BldppBNgU4OoYVDHxfsPf0c4L7vAp%2FQHzA50NxRer2GltMv76u55G3%2FLde9ERQK3eYeTQhvEZrcNugVLBIxfIG2rI%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D", "expiration": "2023-04-24T20:07:57Z" }

dhulipudi commented 1 year ago

https://webexapis.com/v1/meetings/join

23459549725

YjJjNGQwYjMtOTBiOS00MjZlLWFlNmEtN2U0ZTkxNDc5NjdmMDQ1NDcwMWEtNmFl_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9

dhulipudi commented 1 year ago

public String getApiResponse() { logger.info(":::2:::::"); try (CloseableHttpClient httpClient = createHttpClient(httpFactory)){ String url="https://webexapis.com/v1/meetings/list-meetings"; //String url="https://developer.webex.com/docs/api/v1/meetings/list-meetings";

    logger.info("URL:"+url);
     HttpGet httpGet = new HttpGet(url);
     String acctoken="ZDY5MWU2MTgtN2NkZi00ZDNmLTlhNjctNGYwZmVmYjU0MzlmMTI3ZDRjYWUtYzNh_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9";

     httpGet.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
     httpGet.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " +acctoken);
     CloseableHttpResponse httpResponse = httpClient.execute(httpGet);
     HttpEntity getEntity = httpResponse.getEntity();
     String getContent = EntityUtils.toString(getEntity);
     logger.info("getContent :"+getContent);

     return getContent;

 } catch (Exception e) {
    logger.error("Issue fetching taken getApiResponse   exceptionMsg: {}", e.getMessage());
 }
 return null;

}

dhulipudi commented 1 year ago

==============post========

public String getPostResponseOne() {

    logger.info(":::2:getPostResponseOne::::");
    String acctoken1="ZDY5MWU2MTgtN2NkZi00ZDNmLTlhNjctNGYwZmVmYjU0MzlmMTI3ZDRjYWUtYzNh_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9";

    HttpClient client = new DefaultHttpClient();
    HttpPost post = new HttpPost("https://webexapis.com/v1/meetings/join");
    post.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
    post.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " +acctoken1);

    try {

        logger.info(":::3:getPostResponseOne::::");
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);

        nameValuePairs.add(new BasicNameValuePair("meetingNumber", "23459549725"));

        post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        HttpResponse response = client.execute(post);

        logger.info("---->>>>Response :"+response.getStatusLine().getStatusCode());

        BufferedReader rd = new BufferedReader(new InputStreamReader(
                response.getEntity().getContent()));
        String line = "";
        while ((line = rd.readLine()) != null) {
            logger.info("---->>>>getPostResponseOne :"+line);
        }

    } catch (IOException e) {
        logger.error("Issue fetching taken getApiResponse   exceptionMsg: {}", e.getMessage());
    }

    return "Test";
}
dhulipudi commented 1 year ago

YjJjNGQwYjMtOTBiOS00MjZlLWFlNmEtN2U0ZTkxNDc5NjdmMDQ1NDcwMWEtNmFl_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9

dhulipudi commented 1 year ago
private String getSingle(HttpGet request) throws WebinarCCCCCCCException {
    setCredentials(request);
    try (CloseableHttpClient httpClient = buildHttpClient()) {
        URI uri = buildUri(request);
        request.setURI(uri);
        HttpResponse response = httpClient.execute(request);
        return IOUtils.toString(response.getEntity().getContent(),
                StandardCharsets.UTF_8);
    } catch (URISyntaxException | IOException e) {
        throw new WebinarException("Error getting data from Zoom API", e);
    }
}
dhulipudi commented 1 year ago

curl https://webexapis.com/v1/meetings/join -H "Content-Type: application/json" -H "Authorization: Bearer YjJjNGQwYjMtOTBiOS00MjZlLWFlNmEtN2U0ZTkxNDc5NjdmMDQ1NDcwMWEtNmFl_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9" -d '{"meetingNumber": 23459549725, "joinDirectly": false}'

dhulipudi commented 1 year ago

{ "startLink": "https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAaTqEQjB1uMqygKYk1%2FxfWRBgI1H9Duxy3e0hLzrDgBQkdSnqQZZjfhGULFn%2BstwLx2V3JVJu2YDivOpc971ibCx23PNaXhG8QPbWQ7nAazAFN6WU1tdNrsbgZ13C0Md8xM05e6GgPjeOMisCpYBf7dHWtmRhQX2g43Vy%2BsFOK%2F%2BYvd7dUIS25EfNxPry%2BPbzxTrdVMuMVrdX4o3s2DRVIeD7i8%2BTyoUXbMRU%2FD2rRzN1zjVbsPXcyHnYNWW11UIO0rFljEmcDR2PFRoA%2FTkw5L&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAZ%2Fw46ennH5lXi03GnIRYJfe11sdecP107Q7ic0e4S41M6piBEiDA1YMUI9rIsL0favr6e1e7PuE%2FCi3DAIux85hSoON2boMsbq84NTLemOShDESQlufnFW5kX6A7F3TEo%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D", "joinLink": "https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAZBz5eec%2F%2BC5h8%2BAbS9nEE1X6%2FKYK0KC1s1gGjGAjfCLABSsXojfPn6SvN8MBP0aDLKZQ%2FKQWtWqYPxvwBOzLNFuMyjQSgJu7ZA7pzgfGTcUVNvWg85X9vZ953k%2BwsjkxUdB69bRyAbTghdqnh67iRp4%2FNIrqHpnRa5gjfWaJHWukQN%2B0PkKOQrwdeBKdT4IsX6FujJoyr4fh2%2FASWsEOnOAbNmMERFewCbSQR2Txj009jnaaZwPVQYL8ZpYi59%2FzEypAGeKCEJ0xwDHLBcdRDs&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAbZDK%2Bo4DLHF91s2W00otuf6%2F3FZ11cV%2BtwGnRBp0tvZiC6dknIVHV8hvnar7th0SS9AyaEuUGPzO9n9pRq9LKCmJ6dWs%2ByURakPZM9am5evrnH2yCYXuRMfaiSlfUucNI%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D", "expiration": "2023-04-25T02:28:15Z" }

dhulipudi commented 1 year ago

https://reqbin.com/curl

dhulipudi commented 1 year ago

String query = "email="+URLEncoder.encode("abc@xyz.com","UTF-8"); query += "&"; query += "password="+URLEncoder.encode("abcd","UTF-8") ;

URL myurl = new URL(httpsURL); HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection(); con.setRequestMethod("POST");

con.setRequestProperty("Content-length", String.valueOf(query.length())); con.setRequestProperty("Content-Type","application/x-www- form-urlencoded"); con.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0;Windows98;DigExt)"); con.setDoOutput(true); con.setDoInput(true);

DataOutputStream output = new DataOutputStream(con.getOutputStream());

output.writeBytes(query);

output.close();

DataInputStream input = new DataInputStream( con.getInputStream() );

for( int c = input.read(); c != -1; c = input.read() ) System.out.print( (char)c ); input.close();

System.out.println("Resp Code:"+con .getResponseCode()); System.out.println("Resp Message:"+ con .getResponseMessage());

dhulipudi commented 1 year ago

URL url = new URL("https://webexapis.com/v1/meetings/join"); HttpURLConnection http = (HttpURLConnection)url.openConnection(); http.setRequestMethod("POST"); http.setDoOutput(true); http.setRequestProperty("Content-Type", "application/json"); http.setRequestProperty("Authorization", "Bearer YjJjNGQwYjMtOTBiOS00MjZlLWFlNmEtN2U0ZTkxNDc5NjdmMDQ1NDcwMWEtNmFl_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9");

String data = "{\"meetingNumber\": 23459549725, \"joinDirectly\": false}";

byte[] out = data.getBytes(StandardCharsets.UTF_8);

OutputStream stream = http.getOutputStream(); stream.write(out);

System.out.println(http.getResponseCode() + " " + http.getResponseMessage()); http.disconnect();

dhulipudi commented 1 year ago

import java.util.; import java.lang.; import java.io.; import java.nio.charset.; import java.net.*;

/ Name of the class has to be "Main" only if the class is public. / class Ideone { public static void main (String[] args) throws java.lang.Exception { URL url = new URL("https://w./..content-available-to-author-only...[s.com/v1/meetings/join](http://s.com/v1/meetings/join)"); HttpURLConnection http = (HttpURLConnection)url.openConnection(); http.setRequestMethod("POST"); http.setDoOutput(true); http.setRequestProperty("Content-Type", "application/json"); http.setRequestProperty("Authorization", "Bearer YjJjNGQwYjMtOTBiOS00MjZlLWFlNmEtN2U0ZTkxNDc5NjdmMDQ1NDcwMWEtNmFl_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9");

String data = "{\"meetingNumber\": 23459549725, \"joinDirectly\": false}";

byte[] out = data.getBytes(StandardCharsets.UTF_8);

OutputStream stream = http.getOutputStream(); stream.write(out);

System.out.println(http.getResponseCode() + " " + http.getResponseMessage()); http.disconnect(); } }

dhulipudi commented 1 year ago

import java.util.; import java.lang.; import java.io.; import java.nio.charset.; import java.net.*;

public class HelloWorld {

public static void main(String []args) {
    System.out.println("Hello, World!");
    try {

        URL url = new URL("https://webexapis.com/v1/meetings/join");
        HttpURLConnection http = (HttpURLConnection)url.openConnection();
        http.setRequestMethod("POST");
        http.setDoOutput(true);
        http.setRequestProperty("Content-Type", "application/json");
        http.setRequestProperty("Authorization", "Bearer OGVhZTM3MTQtZGM0ZS00MjEwLTgyNjYtNGNiNWIwMmUwNmNiZTUzZTJlYjMtZjMx_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9");

        String data = "{\"meetingNumber\": 23459549725, \"joinDirectly\": false}";

        byte[] out = data.getBytes(StandardCharsets.UTF_8);

        OutputStream stream = http.getOutputStream();
        stream.write(out);

        System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
        http.disconnect();

    } catch (Exception e) {
        System.out.println("Issue fetching"+e.getMessage());
    }
dhulipudi commented 1 year ago

private HttpsURLConnection getConnection(URL url) throws IOException { try { SSLContext ssl = SSLContext.getInstance("TLSv1.2"); ssl.init(null, null, new SecureRandom()); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.setSSLSocketFactory(ssl.getSocketFactory()); connection.setRequestProperty("Content-type", "application/json"); if (apiBearerToken != null) { String authorization = apiBearerToken; if (!authorization.startsWith("Bearer ")) { authorization = "Bearer " + apiBearerToken; } connection.setRequestProperty("Authorization", authorization); }

    //connection.setRequestMethod("POST");
   // int responseCode = connection.getResponseCode();

   // logger.info(":::<<<<333>>>>:LLLL::::"+responseCode);
    //connection.setRequestProperty(TRACKING_ID, UUID.randomUUID().toString());
    return connection;
} catch (Exception ex) {
    throw new IOException(ex.getMessage());
}

}

dhulipudi commented 1 year ago

YzNlY2YxMWMtNGNjZC00YjUyLWI5ZWItODk5ODNjMzBkNjBhNzVlYTVkNjEtOTA5_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9

dhulipudi commented 1 year ago

package com.test;

import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets;

public class TestHttpPost { public static void main(String[] args) throws IOException { URL url = new URL("https://webexapis.com/v1/meetings/join"); HttpURLConnection http = (HttpURLConnection)url.openConnection(); http.setRequestMethod("POST"); http.setDoOutput(true); http.setRequestProperty("Content-Type", "application/json"); http.setRequestProperty("Authorization", "Bearer YzNlY2YxMWMtNGNjZC00YjUyLWI5ZWItODk5ODNjMzBkNjBhNzVlYTVkNjEtOTA5_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9");

    String data = "{\"meetingNumber\": 23459549725, \"joinDirectly\": false}";

    byte[] out = data.getBytes(StandardCharsets.UTF_8);

    OutputStream stream = http.getOutputStream();
    stream.write(out);

    System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
    http.disconnect();
}

}

dhulipudi commented 1 year ago

PS C:\Users\u76L\Downloads\java-test-l> java TestHttpPost.java Exception in thread "main" javax.net.ssl.SSLException: Connection reset at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:127) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:349) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:292) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:287) at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:144) at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1408) at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1314) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411) at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567) at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197) at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1367) at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1342) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:246) at TestHttpPost.main(TestHttpPost.java:20) Suppressed: java.net.SocketException: Connection reset by peer: socket write error at java.base/java.net.SocketOutputStream.socketWrite0(Native Method) at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110) at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150) at java.base/sun.security.ssl.SSLSocketOutputRecord.encodeAlert(SSLSocketOutputRecord.java:81) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:380) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:292) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:287) at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:144) at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1408) at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1314) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411) at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567) at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197) at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1367) at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1342) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:246) at TestHttpPost.main(TestHttpPost.java:20) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:404) at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:179) at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:119) Caused by: java.net.SocketException: Connection reset at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186) at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140) at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478) at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472) at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160) at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:110) at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1408) at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1314) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440) at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411) at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567) at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:197) at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1367) at java.base/sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1342) at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:246) at TestHttpPost.main(TestHttpPost.java:20) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:404) at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:179) at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:119) PS C:\Users\u76L\Downloads\java-test-l>

dhulipudi commented 1 year ago

12.06.2023 16:42:56.802 INFO [10.122.27.113 [1686602574730] GET /content/retail/public/us/en/user-testing/a-spot.html HTTP/1.1] com.vanguard.retail.ui.marketingsite.core.services.impl.WebExAPIClientServiceImpl :: JOIN WEBEX Meeting - joinLink Message :: {"startLink":"https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAYkPD%2B8A8kfqm5j124Po0K1PVw21GUBq%2FOIERMlmZmOgFHp7VhRzmWCeK%2FMvfnmUqq0TUp2lazQ0cPHCPlPNbpU7hKPASpudQNTvWgQMms335fiMxt%2BKhy5xO9O5FhN9uEOC8OJpMDDBV6y%2B6SKBR2IfavMH9rB2GcQpyXsIO%2FxyYLzdIPDEJG33%2FQdNOD9nsCqTMcjoZogbOVBtdReOUBKT1DuzO99v%2BEQDC%2FPDiyVHbtEfiKHQa5y3tweAB4w7qrwfAX%2BPvcUaH995x%2BGt3Ev&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAaki1ReTR4wNh6%2BO8bZs1TuFg%2BgUYcq1oZ%2BY3Snm%2BCpfwPBRKdnZ0XGwuByuL7xXsqYLyPpWGZuN6%2BKrmi7uQt4fxAziTcBKqpbS7zSN%2FlqTjBZx0z58QxRfQM3YqeGXZs%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D","joinLink":"https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAYkPD%2B8A8kfqm5j124Po0K1PVw21GUBq%2FOIERMlmZmOgFHp7VhRzmWCeK%2FMvfnmUqq0TUp2lazQ0cPHCPlPNbpU7hKPASpudQNTvWgQMms335fiMxt%2BKhy5xO9O5FhN9uEOC8OJpMDDBV6y%2B6SKBR2IfavMH9rB2GcQpyXsIO%2FxyYLzdIPDEJG33%2FQdNOD9nsCqTMcjoZogbOVBtdReOUBKT1DuzO99v%2BEQDC%2FPDiyVHbtEfiKHQa5y3tweAB4w7qrwfAX%2BPvcUaH995x%2BGt3Ev&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAaki1ReTR4wNh6%2BO8bZs1TuFg%2BgUYcq1oZ%2BY3Snm%2BCpfwPBRKdnZ0XGwuByuL7xXsqYLyPpWGZuN6%2BKrmi7uQt4fxAziTcBKqpbS7zSN%2FlqTjBZx0z58QxRfQM3YqeGXZs%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D","expiration":"2023-06-12T20:47:56Z"}

{"startLink":"https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAY%2BURLHmddExklZYNueFKiiyPA%2B7lFEugYgIBIHOnWTdVcIDzjGvLRuDQAMLz%2BcY9vbmWFanhzQyx639V7NizNHrXFM84ZH%2FAoT1YEs%2B4ee%2BlvDLT19%2FbcQ1PnDjeP%2Bigm2hJ29ArxOVilW33esETB9%2FEqiDyi889Qd1TDu%2FBmFjvZLkaavrdVH3SUUC2shLuFA%2F7ilIj7H5sFls2wboevYhlem9ub%2FU0iWh8mRhBwNqoxvGrGonxKv9ayGFQjiDIyOlvnkVfJ4eqiJIiTiTCcT&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAZ7xN6DQPuFyO%2BZ3XEkxhPnbTrOMqzmF9BcrdUH6i%2BYvNyyZm%2BqpTRtDGa6W3IlVfBaYLD0poSFJJCz2ipWWmI6GE1EM%2BfFvMCwddteSYj1DpH%2F3O7JyxD%2BN8UTT3mbfFQ%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D","joinLink":"https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAY%2BURLHmddExklZYNueFKiiyPA%2B7lFEugYgIBIHOnWTdVcIDzjGvLRuDQAMLz%2BcY9vbmWFanhzQyx639V7NizNHrXFM84ZH%2FAoT1YEs%2B4ee%2BlvDLT19%2FbcQ1PnDjeP%2Bigm2hJ29ArxOVilW33esETB9%2FEqiDyi889Qd1TDu%2FBmFjvZLkaavrdVH3SUUC2shLuFA%2F7ilIj7H5sFls2wboevYhlem9ub%2FU0iWh8mRhBwNqoxvGrGonxKv9ayGFQjiDIyOlvnkVfJ4eqiJIiTiTCcT&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAZ7xN6DQPuFyO%2BZ3XEkxhPnbTrOMqzmF9BcrdUH6i%2BYvNyyZm%2BqpTRtDGa6W3IlVfBaYLD0poSFJJCz2ipWWmI6GE1EM%2BfFvMCwddteSYj1DpH%2F3O7JyxD%2BN8UTT3mbfFQ%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D","expiration":"2023-06-13T17:33:17Z"}

i.marketingsite.core.services.impl.WebExAPIClientServiceImpl :: JOIN WEBEX Meeting - strCurrentLine Message ::{"startLink":"https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAb7mqjk9c27qPnPIGwJTsgIs9BrGcSfQeLTJGyd2SxOY%2BviyNQ0253l7AN2X9agbaSVGi8zEPKbJfvMuiwVVGXCMK7e6da2F2q0zLLWVy%2BXvV2lBHrlxeuLgkmbSPu8lGyd5%2BktZe2dK0VI8vrVEy9oKu4URXIDoEntAJ1yFo3VAAImr49R9KedibNJwN%2Bsb1GflKrNu9CV4JDBwQGgQSDZWj43k08rNTkfLMbZJsc2Sc%2FMyW7VwjEQuXAufI12d66OeRtoC0W59ldVRiI1rc6R&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAbzdDca%2F%2F1iW3Uo0J9Wh7o%2FXogOEFnEJZLQKCCfKdTHKjLVeaBUfU1spjYM4ZE5yZdlKHII%2FcujU86Z2NSLkh4QzryYzzQFhfxy7ZjDRwD1QtFtLXOCSTyzTqKm4OAJBP0%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D","joinLink":"https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAb7mqjk9c27qPnPIGwJTsgIs9BrGcSfQeLTJGyd2SxOY%2BviyNQ0253l7AN2X9agbaSVGi8zEPKbJfvMuiwVVGXCMK7e6da2F2q0zLLWVy%2BXvV2lBHrlxeuLgkmbSPu8lGyd5%2BktZe2dK0VI8vrVEy9oKu4URXIDoEntAJ1yFo3VAAImr49R9KedibNJwN%2Bsb1GflKrNu9CV4JDBwQGgQSDZWj43k08rNTkfLMbZJsc2Sc%2FMyW7VwjEQuXAufI12d66OeRtoC0W59ldVRiI1rc6R&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAbzdDca%2F%2F1iW3Uo0J9Wh7o%2FXogOEFnEJZLQKCCfKdTHKjLVeaBUfU1spjYM4ZE5yZdlKHII%2FcujU86Z2NSLkh4QzryYzzQFhfxy7ZjDRwD1QtFtLXOCSTyzTqKm4OAJBP0%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D","expiration":"2023-06-13T18:16:06Z"}a

{"startLink":"https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAZV1h0PaFWX2IdVN%2FWY7xbdLPEG0bKdIqzgaRwbtCDrEB6weG9JqJv99G1ttrndak4AsMhX29Jb7I%2B%2B1Q1MP0V6JgefnHn7gmTf3vjPSx2x5sE8tDUuoEVZnm2pmQ0956iMNEVZOphNDIilKttGLURqm0GrZZauXP5qaXNRWsfRi7EFjprZk%2FAxFxnBw9Mk1MNpVClIDnQWOLpEv1OeurEo5MGJNAdMCeMLD0WHH3PrQzAHXM9sG61cPnJv8IcrrHbNMszwUPgW%2B914N8K7YxAz&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAZoPTIpCtAFA9zq9MDCzZM8wbQqBBuF5TqMWb2U8Po97HUb8djjMhHUwCQX1BVAJgI2G4NhQqi8JkEIJ7ydgvvNM8fnojINPT69wew%2FURDx8x5Y83Vrspsm%2FALXWvOTczo%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D","joinLink":"https://vanguardgroup.webex.com/wbxmjs/joinservice/sites/vanguardgroup/meeting/download/5bd7f3f0574f46b19cb4a0d8a55e66de?siteurl=vanguardgroup&integrationJoinToken=QUhTSwAAAAZV1h0PaFWX2IdVN%2FWY7xbdLPEG0bKdIqzgaRwbtCDrEB6weG9JqJv99G1ttrndak4AsMhX29Jb7I%2B%2B1Q1MP0V6JgefnHn7gmTf3vjPSx2x5sE8tDUuoEVZnm2pmQ0956iMNEVZOphNDIilKttGLURqm0GrZZauXP5qaXNRWsfRi7EFjprZk%2FAxFxnBw9Mk1MNpVClIDnQWOLpEv1OeurEo5MGJNAdMCeMLD0WHH3PrQzAHXM9sG61cPnJv8IcrrHbNMszwUPgW%2B914N8K7YxAz&displayname=Dhulipudi%2CSuresh&email=suresh_dhulipudi%40vanguard.com&principal=QUhTSwAAAAZoPTIpCtAFA9zq9MDCzZM8wbQqBBuF5TqMWb2U8Po97HUb8djjMhHUwCQX1BVAJgI2G4NhQqi8JkEIJ7ydgvvNM8fnojINPT69wew%2FURDx8x5Y83Vrspsm%2FALXWvOTczo%3D&integrationEndUrl=https%3A%2F%2Fvanguardgroup.webex.com%2Fmc3300%2Fmeetingcenter%2Fmeetingend%2Fmeetingend.do%3Fsiteurl%3Dvanguardgroup%26from%3Dmeeting%26backurl%3D","expiration":"2023-06-13T20:57:27Z"}

dhulipudi commented 1 year ago

window.addEventListener('load', function () { const tickers = document.querySelectorAll('.cmp-ticker');

tickers.forEach(function (ticker) { const endpoint = ticker.dataset.marketSummaryUrl;

const options = {
  method: 'GET',
  url: endpoint,
  withCredentials: true,
};

axios(options)
  .then(response => {
    for (let i = 0; i < response.data.quotes.length; i++) {
      populateQuotes(response.data.quotes[i]);
    }
  })
  .catch(function (error) {
    console.log('error - ' + error);
  });

}); }

dhulipudi commented 1 year ago

However, to determine the amount of iterations that this loop performs, the application relies on the user input data at ui.frontend\src\main\webpack\site\components\ticker\js\ticker.js

dhulipudi commented 1 year ago

package com.vg.retail.ui.marketingsite.core.models.impl;

import javax.annotation.PostConstruct; import org.apache.sling.models.annotations.Model; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.injectorspecific.Self; import org.apache.sling.models.annotations.injectorspecific.OSGiService; import org.apache.sling.models.factory.ModelFactory; import com.vanguard.retail.ui.marketingsite.core.services.WebExAPIClientService;

import com.vanguard.retail.ui.marketingsite.core.models.JoinWebExModel; @Model( adaptables = {SlingHttpServletRequest.class}, adapters = {JoinWebExModel.class}, resourceType = {JoinWebExModelImpl.RESOURCE_TYPE}, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL ) public class JoinWebExModelImpl implements JoinWebExModel {

protected static final String RESOURCE_TYPE = "vanguard-retail-common/components/joinwebex";

@Self
private SlingHttpServletRequest request;

@OSGiService
private ModelFactory modelFactory;

@OSGiService
private WebExAPIClientService webExAPIClientService;

private String webExMessage = "";

    /**
* @PostConstruct is immediately called after the class has been initialized
* but BEFORE any of the other public methods.
* It is a good method to initialize variables that is used by methods in the rest of the model
*
*/
@PostConstruct
private void init() {
    webExMessage = webExAPIClientService.testWebExMeeting();
}
@Override
public String getMeetingURL() {
    return "JOIN WEBEX MEETING URL:"+webExMessage;
}

}

dhulipudi commented 1 year ago

package com.vg.retail.ui.marketingsite.core.models.impl;

import javax.annotation.PostConstruct; import org.apache.sling.models.annotations.Model; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.injectorspecific.Self; import org.apache.sling.models.annotations.injectorspecific.OSGiService; import org.apache.sling.models.factory.ModelFactory; import com.vanguard.retail.ui.marketingsite.core.services.WebExAPIClientService;

import com.vanguard.retail.ui.marketingsite.core.models.JoinWebExModel;

@Model( adaptables = {SlingHttpServletRequest.class}, adapters = {JoinWebExModel.class}, resourceType = {JoinWebExModelImpl.RESOURCE_TYPE}, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL ) public class JoinWebExModelImpl implements JoinWebExModel {

protected static final String RESOURCE_TYPE = "vanguard-retail-common/components/joinwebex";

@Self
private SlingHttpServletRequest request;

@OSGiService
private ModelFactory modelFactory;

@OSGiService
private WebExAPIClientService webExAPIClientService;

private String webExMessage = "";

/**
 * @PostConstruct is immediately called after the class has been initialized
 * but BEFORE any of the other public methods.
 * It is a good method to initialize variables that are used by methods in the rest of the model.
 */
@PostConstruct
private void init() {
    webExMessage = webExAPIClientService.testWebExMeeting();
}

@Override
public String getMeetingURL() {
    return "JOIN WEBEX MEETING URL:" + webExMessage;
}

}

dhulipudi commented 1 year ago

However, an attacker can control the target of the request, by sending a URL or other data

dhulipudi commented 1 year ago

<!DOCTYPE html>

AEM Servlet AJAX Example
dhulipudi commented 1 year ago

package com.example.servlets;

import java.io.IOException;

import javax.servlet.Servlet; import javax.servlet.ServletException;

import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.servlets.SlingAllMethodsServlet; import org.osgi.service.component.annotations.Component;

@Component(service = Servlet.class, property = { "sling.servlet.methods=GET", "sling.servlet.paths=/bin/my-servlet" }) public class MyServlet extends SlingAllMethodsServlet {

@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/plain");
    response.getWriter().write("Hello from MyServlet!");
}

}

dhulipudi commented 1 year ago

<!DOCTYPE html>

AEM Servlet AJAX Example
dhulipudi commented 1 year ago

<!DOCTYPE html>

AEM Servlet AJAX Example
dhulipudi commented 1 year ago

/*


*

import com.vanguard.retail.ui.marketingsite.core.services.WebExAPIClientService; import com.vanguard.retail.ui.marketingsite.core.services.WebExConfiguration; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.osgi.service.metatype.annotations.Designate;

import org.apache.http.entity.ContentType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.nio.charset.StandardCharsets; import java.io.IOException; import java.net.MalformedURLException; import java.net.HttpURLConnection; import java.io.OutputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.net.URL; import org.json.JSONObject; import org.apache.http.osgi.services.HttpClientBuilderFactory;

/**

@Component(service = WebExAPIClientService.class) @Designate(ocd = WebExConfiguration.class) public class WebExAPIClientServiceImpl implements WebExAPIClientService {

private final Logger logger = LoggerFactory.getLogger(getClass());
private static final String APPLICATION_JSON = ContentType.APPLICATION_JSON.getMimeType();

@Reference
private HttpClientBuilderFactory httpFactory;

private static String API_MEETING_NUMBER = "23459549725";
private static String POST_URL = "https://webexapis.com/v1/meetings/join";
private static String POST_METHOD = "POST";
private static String RQ_CONTENT_TYPE = "Content-Type";
private static String RQ_CONTENT_TYPE_APP = "application/json";
private static String RQ_AUTH = "Authorization";
private static String RQ_AUTH_TOKEN = "Bearer NDVkNmUyZmUtZDM3MS00NGRiLTg1MDUtMDljNDljMDgzYjg5ODkyODE3ZWYtMGQ3_PF84_bdc122e7-227a-4c54-a7cf-d487bea7b6d9";
private static String JOIN_MEETING_URL = "";

public String joinWebExMeeting(String meetingNumber) {

    logger.info(":: JOIN WEBEX Meeting - Start::"+meetingNumber);
    String joinLinkURL = "";
    try {

        URL url = new URL(POST_URL);
        HttpURLConnection http = (HttpURLConnection) url.openConnection();
        http.setRequestMethod(POST_METHOD);
        http.setDoOutput(true);
        http.setRequestProperty(RQ_CONTENT_TYPE, RQ_CONTENT_TYPE_APP);
        http.setRequestProperty(RQ_AUTH, RQ_AUTH_TOKEN);

        String data = "{\"meetingNumber\": "+meetingNumber+", \"joinDirectly\": false}";

        byte[] out = data.getBytes(StandardCharsets.UTF_8);
        OutputStream stream = http.getOutputStream();
        logger.info(":: JOIN WEBEX Meeting - stream ::" + stream);
        stream.write(out);
        logger.info(":: JOIN WEBEX Meeting - ResponseCode E ::" + http.getResponseCode());

        /*  Reading Response */
        BufferedReader responseBr = null;
        StringBuilder responseSb = new StringBuilder();

        if (100 <= http.getResponseCode() && http.getResponseCode() <= 399) {
            responseBr = new BufferedReader(new InputStreamReader(http.getInputStream()));
        } else {
            responseBr = new BufferedReader(new InputStreamReader(http.getErrorStream()));
        }
        String strCurrentLine="";
        while ((strCurrentLine = responseBr.readLine()) != null) {
            responseSb.append(strCurrentLine+"\n");
        }

        JSONObject json = new JSONObject(responseSb.toString());

        joinLinkURL = json.getString("joinLink");
        logger.info(":: JOIN WEBEX Meeting URL::" + joinLinkURL);

    } catch (MalformedURLException em) {
        logger.info("MalformedURLException::" + em.getMessage());
    } catch (IOException ei) {
        logger.info("IOException::" + ei.getMessage());
    } catch (Exception ex) {
        logger.info("Exception::" + ex.getMessage());
    }

    logger.info(":: JOIN WEBEX Meeting - END::"+meetingNumber+"::"+joinLinkURL);
    JOIN_MEETING_URL = joinLinkURL;
    return joinLinkURL;
}

public String joinWebExMeetingURL() {
    logger.info(":: JOIN WEBEX Meeting - JOIN_MEETING_URL ::"+JOIN_MEETING_URL);
    return JOIN_MEETING_URL;
}

}

dhulipudi commented 1 year ago

import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.servlets.HttpConstants; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.regex.Pattern; import javax.servlet.Servlet; import java.io.IOException; import com.vanguard.retail.ui.marketingsite.core.services.WebExAPIClientService; @Component(service = Servlet.class, property = {"sling.servlet.methods=" + HttpConstants.METHOD_GET, "sling.servlet.paths=" + "/bin/vanguard/joinwebexmeeting"}) public class JoinWebExMeetingServlet extends SlingSafeMethodsServlet { private static final long serialVersionUID = 1L; private transient final Logger logger = LoggerFactory.getLogger(getClass());

@Reference
WebExAPIClientService webExAPIClientService;

@Override
protected void doGet(final SlingHttpServletRequest req,
                     final SlingHttpServletResponse resp) throws IOException {
    String meetingNumber = req.getParameter("meetingnumber");
    String joinMeetingURL = "";
    logger.info(":: JoinWebExMeetingServlet ::"+req.getParameter("meetingnumber"));
    //Regex validation for a data having a simple format
    if(Pattern.matches("[a-zA-Z0-9\\s\\-]{1,50}", meetingNumber)){
        //Continue the processing because the input data is valid
        logger.info(":: Valid Meeting Number ::");
        joinMeetingURL = webExAPIClientService.joinWebExMeeting(meetingNumber);
    }else{
        //Stop the processing and reject the request
        logger.info(":: Invalid Meeting Number ::");
    }
    resp.getWriter().write(joinMeetingURL);
    logger.info("====== ### JoinWebExMeetingServlet - END ### ====="+joinMeetingURL);
}

}

dhulipudi commented 1 year ago

package com.retail.ui.common.core.models.impl;

import javax.annotation.PostConstruct; import org.apache.sling.models.annotations.Model; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.injectorspecific.Self; import org.apache.sling.models.annotations.injectorspecific.OSGiService; import org.apache.sling.models.factory.ModelFactory; import com.vanguard.retail.ui.common.core.services.WebExAPIClientService; import com.vanguard.retail.ui.common.core.models.JoinWebExModel; /*

}

dhulipudi commented 1 year ago
dhulipudi commented 1 year ago

public interface GTM {

default String getKey() { throw new UnsupportedOperationException(); }

default String getSiteVerification() { throw new UnsupportedOperationException(); } }

dhulipudi commented 1 year ago

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

public class GTMTest implements GTM {

@Test
public void testGetKey() {
    // Test the getKey() method
    GTM gtm = new GTMTest(); // Create an instance of the test class
    assertThrows(UnsupportedOperationException.class, gtm::getKey);
}

@Test
public void testGetSiteVerification() {
    // Test the getSiteVerification() method
    GTM gtm = new GTMTest(); // Create an instance of the test class
    assertThrows(UnsupportedOperationException.class, gtm::getSiteVerification);
}

// You can add more test cases as needed for other methods or scenarios.

}

dhulipudi commented 1 year ago

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows;

public class GTMTest implements GTM {

@Test
public void testGetKey() {
    // Implement the GTM interface's default method for testing
    String expectedKey = "testKey";
    String actualKey = getKey();
    assertEquals(expectedKey, actualKey);
}

@Test
public void testGetSiteVerification() {
    // Implement the GTM interface's default method for testing
    String expectedVerification = "testVerification";
    String actualVerification = getSiteVerification();
    assertEquals(expectedVerification, actualVerification);
}

@Test
public void testGetKeyUnsupportedOperationException() {
    // Test that calling getKey() throws UnsupportedOperationException
    assertThrows(UnsupportedOperationException.class, this::getKey);
}

@Test
public void testGetSiteVerificationUnsupportedOperationException() {
    // Test that calling getSiteVerification() throws UnsupportedOperationException
    assertThrows(UnsupportedOperationException.class, this::getSiteVerification);
}

}

dhulipudi commented 1 year ago

here is the documentation to creating an integration which can generate OAuth tokens for licensed Webex users: https://developer.webex.com/docs/integrations [developer.webex.com]

Here are the items that I think will be more useful:

  1. Guest Issuer App - https://developer.webex.com/docs/guest-issuer [developer.webex.com] Use this to generate JWTs (aka Guest Tokens) for the Vanguard customers that may not have a Webex Account/App.

  2. Widgets - You can use JWTs (as well as OAuth tokens) in the Browser SDK or Widgets to “Authenticate” the Guest users into a Webex Meeting https://developer.webex.com/docs/widgets#meetings-widget- [developer.webex.com] By default, widgets expect you to use something like React to import the Widget library. However, our team has turned the Widget into a CDN style library you can easily import into your HTML: https://github.com/wxsd-sales/embeddable-meetings-widget [github.com]

  3. I believe #1 & #2 above should get you all that you need, but if you want to dive deeper into customization with the Browser SDK instead of widgets, then here is the code repo for the demo I showed: https://github.com/wxsd-sales/guest-join [github.com] This demo takes advantage of an older demo I built to actually show the meeting in the browser. That older demo’s code can be found here: https://github.com/wxsd-sales/wxsd-guest-demo [github.com]

dhulipudi commented 1 year ago

Y2lzY29zcGFyazovL3VzL09SR0FOSVpBVElPTi9jMDE2ZjQxYi0zOTQzLTRkOTUtYjk1Yy1kNDVhYWM0NWFmM2E

g6HjjxjtjinLqhprE0Lpto4BnnwS1l6zz8NX1RCQqDI=

dhulipudi commented 1 year ago

Configure the maven-bundle-plugin as shown below

org.apache.felix maven-bundle-plugin true !android.util;resolution:=optional, !com.fasterxml.jackson.core;resolution:=optional, !com.fasterxml.jackson.databind;resolution:=optional, !org.bouncycastle.jce;resolution:=optional, !org.bouncycastle.jce.spec;resolution:=optional, javax.inject;version=0.0.0,* jjwt;inline=true true
dhulipudi commented 1 year ago
org.apache.felix maven-bundle-plugin true !android.util;resolution:=optional, !com.fasterxml.jackson.core;resolution:=optional, !com.fasterxml.jackson.databind;resolution:=optional, !org.bouncycastle.jce;resolution:=optional, !org.bouncycastle.jce.spec;resolution:=optional, javax.inject;version=0.0.0,* jjwt;inline=true true ``
dhulipudi commented 1 year ago

main pom.xml

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
            <version>0.11.2</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-impl</artifactId>
            <version>0.11.2</version>
        </dependency>
        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-gson</artifactId>
            <version>0.11.2</version>
        </dependency>


velocity,json-simple,jjwt-api,jjwt-impl,jjwt-gson

==============

dhulipudi commented 1 year ago
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt-api</artifactId>
    </dependency>
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt-impl</artifactId>
    </dependency>
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt-gson</artifactId>
    </dependency>
dhulipudi commented 1 year ago

Bundle-ClassPath: .,json-simple-1.1.jar,velocity-1.6.2.jar,jjwt-api-0.11.2.jar,jjwt-impl-0.11.2.jar,jjwt-gson-0.11.2.jar Export-Package :io.jsonwebtoken.*;

dhulipudi commented 1 year ago
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependency</id>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <includeArtifactIds>velocity,json-simple,jjwt-api,jjwt-impl,jjwt-gson</includeArtifactIds>
                    </configuration>
                </execution>
            </executions>
        </plugin>
dhulipudi commented 1 year ago

Solution Design for the Webex Guest Issuer Documentation Page Page Overview: The "Webex Guest Issuer" documentation page aims to guide developers on how to implement and use the Guest Issuer feature within the Webex platform. This feature allows for secure and controlled access to Webex resources for guests (users who do not have Webex accounts).

Target Audience: Developers System Administrators Technical Architects Key Elements and Components: Page Header:

Logo and branding Navigation menu with links to different sections of the documentation Search functionality to help users find specific information quickly Introduction:

Brief explanation of what the Guest Issuer is and why it's valuable. Call to action (CTA) button to encourage users to get started. Getting Started:

Step-by-step guide on how to set up the Guest Issuer. Code snippets and examples illustrating the process. Links to relevant APIs and SDKs. Authentication and Authorization:

Detailed information on how authentication and authorization work with the Guest Issuer. Explanation of token generation and usage. Code samples for various authentication scenarios. API Reference:

Comprehensive list of Guest Issuer APIs with descriptions, parameters, and example usage. Interactive API explorer for testing and experimentation. Links to SDKs in various programming languages. Use Cases and Best Practices:

Real-world use cases for leveraging the Guest Issuer feature. Best practices for secure and efficient integration. Success stories and case studies (if available). Troubleshooting and FAQs:

Common issues users may encounter and their solutions. Frequently asked questions with concise answers. Community and Support:

Links to developer forums, communities, and support resources. Contact information for Webex support. Footer:

Contact information Privacy policy and terms of use links Copyright and trademark information Design Principles: User-Friendly: The documentation should be easy to navigate, with clear headings and a consistent layout. Developer-Centric: Provide practical examples, code snippets, and API references to assist developers in integrating the Guest Issuer. Accessibility: Ensure that the page is accessible to users with disabilities, following WCAG guidelines. Responsive Design: Make the page responsive to different screen sizes and devices. Search Functionality: Implement a robust search feature to help users find relevant information quickly. Technologies and Tools: HTML, CSS, and JavaScript for front-end development API documentation tools for the API reference section Content management system (CMS) for easy content updates Version control system (e.g., Git) for tracking changes Analytics tools to monitor user engagement and behavior Continuous Improvement: Regularly update the documentation to reflect changes and improvements in the Guest Issuer feature. Gather user feedback and analyze analytics data to identify areas for improvement. Maintain version control for the documentation to track changes and revisions. Remember that the actual design and content of the page may evolve over time based on user feedback and changing requirements. It's essential to collaborate with Webex developers and gather input from the target audience to ensure that the documentation effectively serves their needs.

dhulipudi commented 1 year ago

I'm unable to access external websites or specific URLs, including the one you provided, as my training data only goes up until September 2021, and I can't browse the internet. However, I can certainly help you create a solution design for a web page based on the information you provide about the Webex Guest Issuer API documentation.

To create a solution design for this page, you should consider the following elements:

  1. Page Purpose and Audience:

Define the purpose of the page. Is it for developers looking to integrate with Webex using the Guest Issuer API? Identify the target audience: Developers, system administrators, or both.

  1. Page Structure:

Header: Include the Webex logo and navigation menu. Title: Clearly state the purpose of the page, e.g., "Webex Guest Issuer API Documentation." Sections: Divide the page into logical sections, such as: Introduction: Provide a brief overview of what the Guest Issuer API is and why it's important. Authentication: Explain how developers can authenticate with the API (e.g., OAuth 2.0). Endpoints: List and describe the available API endpoints. Request and Response Examples: Include sample API requests and responses. Error Handling: Explain how errors are handled and provide common error codes. Rate Limits: Mention any rate limits or usage restrictions. SDKs and Libraries: If available, provide links to SDKs or code libraries that make API integration easier. Best Practices: Offer recommendations and best practices for using the API effectively.

  1. Documentation Style:

Use clear and concise language. Include code snippets and examples to illustrate API usage. Use headers, subheaders, and bullet points to organize information. Provide links to related resources, such as FAQs, troubleshooting guides, or support forums.

  1. Interactive Features:

Include a search bar to help users find specific topics quickly. Add collapsible sections or tabs to reduce clutter and improve navigation. Include a "Try It Out" feature that allows users to make sample API requests directly from the documentation.

  1. Visual Elements:

Use Webex branding colors and styles. Include diagrams or flowcharts to visualize complex processes. Use icons or call-out boxes to highlight important information.

  1. Responsiveness:

Ensure that the page design is responsive, so it works well on both desktop and mobile devices.

  1. Versioning:

If multiple versions of the API exist, clearly indicate which version the documentation covers.

  1. Feedback and Support:

Include a feedback form or link to gather user input and improve the documentation. Provide contact information for technical support or questions.

  1. Security Considerations:

Highlight any security considerations or best practices for secure API usage.

  1. Updates and Maintenance:

Specify how often the documentation will be updated to reflect changes in the API. Once you've designed the page structure, you can start populating it with content based on the actual Webex Guest Issuer API documentation. Ensure that the information is accurate, up-to-date, and organized for easy navigation and comprehension by developers and administrators.

dhulipudi commented 1 year ago

/bin/querybuilder.json?path=/content/retail&1_property=sling:resourceType&1_property.value=marketing-site/components/quote&p.limit=-1

dhulipudi commented 1 year ago

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project marketing-common-module.core: Compilation failure [ERROR] /C:/AEM-Code/09_24_T3Compile/retail-marketing-common-module/core/src/main/java/com/vanguard/retail/ui/common/core/servlets/JoinWebExMeetingServlet.java:[86,109] no suitable method found for signWith(io.jsonwebtoken.SignatureAlgorithm,java.security.Key) [ERROR] method acscommons.io.jsonwebtoken.JwtBuilder.signWith(acscommons.io.jsonwebtoken.SignatureAlgorithm,byte[]) is not applicable [ERROR] (argument mismatch; io.jsonwebtoken.SignatureAlgorithm cannot be converted to acscommons.io.jsonwebtoken.SignatureAlgorithm) [ERROR] method acscommons.io.jsonwebtoken.JwtBuilder.signWith(acscommons.io.jsonwebtoken.SignatureAlgorithm,java.lang.String) is not applicable [ERROR] (argument mismatch; io.jsonwebtoken.SignatureAlgorithm cannot be converted to acscommons.io.jsonwebtoken.SignatureAlgorithm) [ERROR] method acscommons.io.jsonwebtoken.JwtBuilder.signWith(acscommons.io.jsonwebtoken.SignatureAlgorithm,java.security.Key) is not applicable [ERROR] (argument mismatch; io.jsonwebtoken.SignatureAlgorithm cannot be converted to acscommons.io.jsonwebtoken.SignatureAlgorithm) [ERROR] [ERROR] -> [Help 1] [ERROR]

dhulipudi commented 1 year ago
@Override
protected void doGet(final SlingHttpServletRequest req,
                     final SlingHttpServletResponse resp) throws IOException {
    String meetingNumber = req.getParameter("meetingnumber");
    String joinMeetingURL = "";

    // JWT Tokens Meeting ----- $$$$$$$$$ START  $$$$$$$$$$$$$$$

    String JWT_TOKEN = "";

    String issuer_ID = "Y2lzY29zcGFyazovL3VzL09SR0FOSVpBVElPTi9jODMwNzRjYS04ZjZmLTQ1YmItOTU3Ny1hZTZlMWEwNzcxNjQ";
    String issuer_Name = "guest-join-app";
    String subject = "";
    long ttlMillis = 36000000;
    // call function here createJWT
    JWT_TOKEN =  createJWT(issuer_ID, issuer_Name, subject, ttlMillis);
    logger.info(":: JWT_TOKEN ::::::"+JWT_TOKEN);

    // JWT Tokens Meeting ----- $$$$$$$$$ END  $$$$$$$$$$$$$$$

    logger.info(":: JoinWebExMeetingServlet ::"+req.getParameter("meetingnumber"));
    //Regex validation for a data having a simple format
    if(Pattern.matches("[a-zA-Z0-9\\s\\-]{1,50}", meetingNumber)){
        //Continue the processing because the input data is valid
        logger.info(":: Valid Meeting Number ::");
        joinMeetingURL = webExAPIClientService.joinWebExMeeting(meetingNumber);
    }else{
        //Stop the processing and reject the request
        logger.info(":: Invalid Meeting Number ::");
    }
    resp.getWriter().write(joinMeetingURL);
    logger.info("====== ### JoinWebExMeetingServlet - END ### ====="+joinMeetingURL);
}

public static String createJWT(String id, String issuer, String subject, long ttlMillis) {

    String SECRET_KEY = "+99vslCiKGrGnxLGAGdI+/JqnYfwEQop13Hkpqe4Qko=";
    //The JWT signature algorithm we will be using to sign the token
    SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;

    long nowMillis = System.currentTimeMillis();
    Date now = new Date(nowMillis);

    //We will sign our JWT with our ApiKey secret
    byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(SECRET_KEY);
    Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());

    //Let's set the JWT Claims
    JwtBuilder builder = Jwts.builder().setId(id).setIssuedAt(now).setSubject(subject).setIssuer(issuer).signWith(signatureAlgorithm, signingKey);

    //if it has been specified, let's add the expiration
    if (ttlMillis > 0) {
        long expMillis = nowMillis + ttlMillis;
        Date exp = new Date(expMillis);
        builder.setExpiration(exp);
    }

    //Builds the JWT and serializes it to a compact, URL-safe string
    return builder.compact();
}

}

dhulipudi commented 1 year ago

/**

dhulipudi commented 1 year ago

import io.jsonwebtoken.JwtBuilder; import io.jsonwebtoken.JwtParser; import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.impl.JwtParserImpl; import java.util.Date; import java.util.HashMap; import java.util.Map;

public class JwtTokenGenerator {

private static final String SECRET_KEY = "secret-key";

public static void main(String[] args) {

    // Create claims
    Map<String, Object> claims = new HashMap<>();
    claims.put("sub", "user-id");
    claims.put("role", "admin");
    claims.put("exp", new Date().getTime() + 300000);

    // Create header
    JwtBuilder builder = Jwts.builder();
    builder.setHeaderParams(Map.of("alg", SignatureAlgorithm.HS256.name(), "typ", "JWT"));

    // Set payload
    builder.setClaims(claims);

    // Sign JWT
    String jwt = builder.signWith(SignatureAlgorithm.HS256, SECRET_KEY).compact();

    // Print JWT
    System.out.println(jwt);

    // Verify JWT
    JwtParser parser = new JwtParserImpl();
    JwtClaims claims1 = parser.parseClaimsJws(jwt).getBody();
    System.out.println(claims1);
}

}

dhulipudi commented 1 year ago

import io.jsonwebtoken.JwtBuilder; import io.jsonwebtoken.JwtParser; import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.impl.JwtParserImpl; import java.util.Date; import java.util.HashMap; import java.util.Map;

public class JwtTokenGenerator {

private static final String SECRET_KEY = "secret-key";

public static void main(String[] args) {

    // Create claims
    Map<String, Object> claims = new HashMap<>();
    claims.put("sub", "user-id");
    claims.put("role", "admin");
    claims.put("exp", new Date().getTime() + 300000);

    // Create header
    JwtBuilder builder = Jwts.builder();
    builder.setHeaderParams(Map.of("alg", SignatureAlgorithm.HS256.name(), "typ", "JWT"));

    // Set payload
    builder.setClaims(claims);

    // Sign JWT
    String jwt = builder.signWith(SignatureAlgorithm.HS256, SECRET_KEY).compact();

    // Print JWT
    System.out.println(jwt);

    // Verify JWT
    JwtParser parser = new JwtParserImpl();
    JwtClaims claims1 = parser.parseClaimsJws(jwt).getBody();
    System.out.println(claims1);
}

}

dhulipudi commented 1 year ago
org.apache.felix maven-bundle-plugin true !android.util;resolution:=optional, !com.fasterxml.jackson.core;resolution:=optional, !com.fasterxml.jackson.databind;resolution:=optional, !org.bouncycastle.jce;resolution:=optional, !org.bouncycastle.jce.spec;resolution:=optional, javax.inject;version=0.0.0,* jjwt;inline=true true