in

Base64 decode javascript Online API automation framework

Base64 decode javascript Online API automation framework
Base64 decode javascript Online API automation framework
Spread the love
  • 2
    Shares

Base64 decode javascript Online API automation framework

Hello friends. Welcome back to next one. In this session we are going to discuss how to convert our User Credential into Base64 decode javascript encoded and decoded format. decoded format. Let’s take an example of whats app.

What’s obvious decryption or encrypting your text message whatever you are sending to your friends and real life also whatever user credential or highly confidential data what generally architect or developer has developed logic to simply converting in to the base64 or other format.

So for example let’s say i am logging intomy application and I have to pass username and password so in user name and password I’m passing as a plain textbut they have written to logic like that. Are converting input Base64 decode javascript format so how it works and how we can deal with our framework. So for example this my username and password which is admin and admin admin one two three.

So to convert Base64 decode javascript before that we need to understand what is base64 so base64 is a group of binary to text encoding scheme did represent binary data in to ASCII string format so let’s take an example let’s say my username is a admin and my passwords admin 1 2 3. So this is how I have written here now whereI’m encoding it. So like this in this format developers are sending data from front end to backend to avoid security issues. So now we’ll see how we can do using Javacode.

Base64 decode javascript Online API automation framework
Base64 decode javascript Online API automation framework

So here I’m going to my Java utils class andI’m going to create one method public void Base64 decode javascript and call in try to block what I’m going first. I’m initializing my username and password so my user name will be and this method is going to consume two values which is username and password. So I am writing final String user name and final String password. So this will be considered is it my entire logging credential.

So it will be string cred is equal to username plus password username. Let’s say you are concatenate we think some operator or some random or later so you need to write here username and password. So now your entire value will be admin column admin 1 2 3. So now this string we have to convert it to base64. So what I’m going to do cred is equal to base64so to I have to write Base64 decode javascript which comes inside the Java [dot] utils [dot] get encoder. So suppose you want to decode then you haveto use it decoder.

Otherwise you have to encode. We are who we are going to encode because we are encoded so we are sending data in to encoded format so get encoder [dot] encode to string andwe have to pass our credential so credentials [dot] get bytes. So first we need to convert into bytes is it is explained here binary data into ASCII string.

So we have to use first we need to this credential we need to first convert it into byte and then it is going to convert into Base64 decode javascript format and this string value is going to return me a encoded data. So let me I’m going to print this sea salt and create so this method will work. So now let me test this and we’ll create the main method here and I’m going to create the object of this class to call that method.

utils is equal to java utils and using this utils reference i am calling that method utility load Base64 decode javascript SO i have to pass our credentials so my credentials will be admin and one two three and we have to throw an exception because so this method is going to this line is going to convert my admin and admin 1 2 3 into base encoded format. So let me run this class Yeah. So we’re getting the exact same value whatever we are getting using encoder Yeah. So if we’re going to match this.

These both the values are similler. Now the thing is how we are going to use in our framework so for that let me create one or class here in our pojo package. What I’m going to create I’m going to createa world class which is get credentials. and inside I am getting a credential so private String and credentials. Base64 decode javascript Now I am going to create getters and setters for this. So simply we need to right click source and need to generate getters and setters. So using this i am going to generate getters and setters. So this is all it will be this the credentials. Now we have to call this pojo there.

So let me again go to the java utils. I am going to make this as a static and I’m returning my credential so I’m set using this method I used to say the credential and I put this and Ihope to the return type here. So I need to return type. So what this matter will return me. So first Base64 decode javascript what I’m going to do I’m going to create the object of this class credentials login cred is equal to credentials and then login cred[dot] set credentials. And I have to pass as a cred. So using this method I’m going to set the credential and then it will return as a login credentials. credentials.

So return login cred. So now we’ve created. So using this method it is going to set in that pojo class. So using this credential it is going to set inside the pojo class. Now let’s say we are going to test this method. So how it works Base64 decode javascript So for this let me create one logging test class and inside this I’m going to create one test method. Public void login test. So yeah I objective is to verify that input flow is working or not.

We need to call this credential put your credentials credential log in create and we need to import this Java utils [dot] Base64 decode javascript. So here we need to pass out a username and password. So my user name is admin me and my passwords let’s say admin. One two three. And this method is going to return me a Base64 decode javascript value. So let’s I’m going to print this login cred and let me run this.

So this method is going to return me a encoded data the same data whatever we are getting here. Thank you guys. Thanks for watching this video.

Written by Getidea24

Leave a Reply

Your email address will not be published. Required fields are marked *

Death on the nile the movie

Death on the nile the movie

Change Color of png file in Photoshop easy way

Change Color of png file in Photoshop easy way