JWT Fundamentals for Beginners

In this article, the fundamentals of what JSON Web Tokens (JWT) are, and why they are used will be explained.

JSON Web Tokens (JWT) are an important piece in ensuring trust and security in your application. **JWT **allow claims, such as user data, to be represented in a secure manner.

To explain how JWT work, let’s begin with an abstract definition.

Simply put, a JWT is just a string with the following format:


It should be noted that a double quoted string is actually considered a valid JSON object.

To show how and why **JWT **are actually used, we will use a simple 3 entity example (see the below diagram). The entities in this example are the user, the application server, and the authentication server. The authentication server will provide the **JWT **to the user. With the JWT, the user can then safely communicate with the application.

How an application uses **JWT **to verify the authenticity of a user.

In this example, the user first signs into the authentication server using the authentication server’s login system (e.g. username and password, Facebook login, Google login, etc). The authentication server then creates the JWT and sends it to the user. When the user makes API calls to the application, the user passes the **JWT **along with the API call. In this setup, the application server would be configured to verify that the incoming JWT are created by the authentication server (the verification process will be explained in more detail later). So, when the user makes **API **calls with the attached JWT, the application can use the **JWT **to verify that the **API **call is coming from an authenticated user.

Now, the JWT itself, and how it’s constructed and verified, will be examined in more depth.

Step 1. Create the HEADER

The header component of the JWT contains information about how the JWT signature should be computed. The header is a JSON object in the following format:

    "typ": "JWT",
    "alg": "HS256"

In this JSON, the value of the “typ” key specifies that the object is a JWT, and the value of the “alg” key specifies which hashing algorithm is being used to create the JWT signature component. In our example, we’re using the HMAC-SHA256 algorithm, a hashing algorithm that uses a secret key, to compute the signature (discussed in more detail in step 3).

Step 2. Create the PAYLOAD

The payload component of the JWT is the data that‘s stored inside the JWT (this data is also referred to as the “claims” of the JWT). In our example, the authentication server creates a JWT with the user information stored inside of it, specifically the user ID.

    "userId": "b08f86af-35da-48f2-8fab-cef3904660bd"

The data inside the payload is referred to as the “claims” of the token.

In our example, we are only putting one claim into the payload. You can put as many claims as you like. There are several different standard claims for the **JWT **payload, such as “iss” the issuer, “sub” the subject, and “exp” the expiration time. These fields can be useful when creating JWT, but they are optional. See the wikipedia page on JWT for a more detailed list of **JWT **standard fields.

Keep in mind that the size of the data will affect the overall size of the JWT, this generally isn’t an issue but having excessively large JWT may negatively affect performance and cause latency.

Step 3. Create the SIGNATURE

The signature is computed using the following pseudo code:

// signature algorithm
data = base64urlEncode( header ) + “.” + base64urlEncode( payload )
hashedData = hash( data, secret )
signature = base64urlEncode( hashedData )

What this algorithm does is base64url encodes the header and the payload created in steps 1 and 2. The algorithm then joins the resulting encoded strings together with a period (.) in between them. In our pseudo code, this joined string is assigned to data. The data string is hashed with the secret key using the hashing algorithm specified in the JWT header. The resulting hashed data is assigned to hashedData. This hashed data is then base64url encoded to produce the JWT signature.

In our example, both the header, and the payload are base64url encoded as:

// header
// payload

Then, applying the specified signature algorithm with the secret key on the period-joined encoded header and encoded payload, we get the hashed data needed for the signature. In our case, this means applying the HS256 algorithm, with the secret key set as the string “secret”, on the data string to get the hashedData string*.* After, through base64url encoding the hashedData string we get the following JWT signature:

// signature

Step 4. Put All Three JWT Components Together

Now that we have created all three components, we can create the JWT. Remembering the header.payload.signature structure of the JWT, we simply need to combine the components, with periods (.) separating them. We use the base64url encoded versions of the header and of the payload, and the signature we arrived at in step 3.

// JWT Token

You can try creating your own JWT through your browser at jwt.io.

Going back to our example, the authentication server can now send this JWT to the user.

How does JWT protect our data?

It is important to understand that the purpose of using JWT is NOT to hide or obscure data in any way. The reason why JWT are used is to prove that the sent data was actually created by an authentic source.

As demonstrated in the previous steps, the data inside a JWT is encoded and signed, not encrypted. The purpose of encoding data is to transform the data’s structure. Signing data allows the data receiver to verify the authenticity of the source of the data. So encoding and signing data does NOT secure the data. On the other hand, the main purpose of encryption is to secure the data and to prevent unauthorized access.

Since JWT are signed and encoded only, and since JWT are not encrypted, JWT do not guarantee any security for sensitive data.## Step 5. Verifying the JWT

In our simple 3 entity example, we are using a **JWT **that is signed by the **HS256 **algorithm where only the authentication server and the application server know the secret key. The application server receives the secret key from the authentication server when the application sets up its authentication process. Since the application knows the secret key, when the user makes a JWT-attached API call to the application, the application can perform the same signature algorithm as in Step 3 on the JWT. The application can then verify that the signature obtained from it’s own hashing operation matches the signature on the JWT itself (i.e. it matches the JWT signature created by the authentication server). If the signatures match, then that means the JWT is valid which indicates that the API call is coming from an authentic source. Otherwise, if the signatures don’t match, then it means that the received JWT is invalid, which may be an indicator of a potential attack on the application. So by verifying the JWT, the application adds a layer of trust between itself and the user.

In Conclusion

We went over what JWT are, how they are created and validated, and how they can be used to ensure trust between an application and its users. This is a starting point for understanding the fundamentals of JWT and why they are useful. JWT are just one piece of the puzzle in ensuring trust and security in your application.

It should be noted that the JWT authentication setup described in this article is using a symmetric key algorithm (HS256). You can also set up your JWT authentication in a similar way except using an asymmetric algorithm (such as RS256) where the authentication server has a secret key, and the application server has a public key.

#security #javascript

What is GEEK

Buddha Community

JWT Fundamentals for Beginners
Shayne  Bayer

Shayne Bayer


JSON Web Token (JWT) — Create and Use in ASP.NET Core (API Calling)

What is JSON Web Token?

#jwt #jwt-auth #jwt-token #aspnetcore #asp.net core #asp.net (.net)

Biju Augustian

Biju Augustian


Java Fundamentals: Learn Java for absolute beginners |Simpliv

This is the best course to learn to program in Java in Spanish from scratch and without any experience in this fabulous programming language. This is the first course where we will study the Fundamentals of Java, and we will take you step by step until you acquire the bases of the Java language and you can start to study more advanced Java topics.

The content is divided into perfectly structured levels, each level supported by the previous one, with the aim of adding Java knowledge incrementally and so you can focus on mastering the issues little by little and gradually. So ensure the success of your Java training.

We will also offer support for any doubts about the didactic material included in this Java Fundamentals course.

We manage a new teaching methodology that we have called Speed ​​Learning. This methodology consists of concise videos that go directly to the point to be studied, complemented by eBooks with explanations and step-by-step images (which you can print, or search for any text you need, or use for your offline study), since As we know we can not do text search within a video. In addition, our methodology includes perfectly structured and very didactic exercises that will allow you to accelerate your eLearning learning. No loss of time in videos where you have to watch the instructor codify an exercise, too much theory, little practice or anything like that. Our Speed ​​Learning methodology guarantees that in the shortest possible time you will acquire the necessary knowledge for the Java professional and working world.

The Java Fundamentals course includes the following topics for study:

Lesson 1 - Starting with Java Technology

The amazing world of Java programming

What is Java technology (from a practical approach)

Our first Java program from scratch

Lesson 2 - Variables and Operators in Java

Use of Variables in Java and what we use them for

Types of Data in Java and how they are classified

Management and Classification of operators in Java

Lesson 3 - Control statements in Java

Using the if-else structure and where to use it

Handling the switch structure and when applying it

Lesson 4 - Handling Loops in Java

Use of the for loop and its use

Using the while loop and how to apply it

Use of the do-while loop and when to use it

Lesson 5 - Object Oriented Programming

Introduction to Object Oriented Programming (OOP)

Handling Classes in Java

Use of Objects in Java

Lesson 6 - Functions in Java

Declaration of Methods or Functions in Java

Use and call of functions in Java

Lesson 7 - Data Management in Java

Using Arrays in Java

Management of Matrices in Java

Lesson 8 - Inheritance in Java

Inheritance Management in Java

Use of superclasses and subclasses in Java

Final Level Laboratory

Final Exercise where everything learned in this Level is integrated

At the end you get a certificate of having completed the Java Fundamentals course.

We wait for you on the other side.

Ing. Ubaldo Acosta

Founder of Global Mentoring

Passion for Java Technology

Who this course is for:

Anyone who wants to learn how to program in Java
Basic knowledge
Basic knowledge of PC use
Basic management of an operating system such as Windows, Mac or Linux
It is not necessary to know how to program, we will start from scratch !!!
The attitude and desire to start coding and learning Java once and for all from scratch!
What will you learn
Have the basics of the programming language with Java
You will know the basic syntax of the Java language
Manage the concept of Variables and Operators in Java
We will study Object Oriented Programming with Java
You will learn the Control Statements and Loops in Java
We will see the concept of Functions with Java
We will study the concept of Inheritance in Java
We will learn to use Arrays in java
We will handle the concept of Matrices in Java
We will learn to Design Classes in Java
We will make a final application with everything learned in the course
To continue:

#java #fundamentals #beginners

Alisha  Larkin

Alisha Larkin


HTML Fundamentals: Tables And Lists [Part 2]

Hello Again, in the last blog, we covered a lot of basics in HTML and today’s blog will be short and sweet where we will be looking at how we can arrange the content on the web page. We can arrange data in an organized way by putting them in different tables or you can simply put it in a list that can be ordered or unordered. We will also see how we can arrange them in columns and certain layouts within the webpage.

We’ll go through each of them step by step.

Let’s start with tables.

Tables are nothing but a collection of data that is organized into columns and rows. A fundamental table contains columns, rows, headers etc.

If we want to define a table within our HTML page, we use the tag

Simple. Isn’t it?

#html-fundamentals #learning-html #tech-beginners-guide #web-development #html #beginners #learning-to-code

Sival Alethea

Sival Alethea


Learn Java 8 - Full Tutorial for Beginners. DO NOT MISS!!!

Learn Java 8 and object oriented programming with this complete Java course for beginners.
⭐️Contents ⭐️

⌨️ (0:00:00) 1 - Basic Java keywords explained
⌨️ (0:21:59) 2 - Basic Java keywords explained - Coding Session
⌨️ (0:35:45) 3 - Basic Java keywords explained - Debriefing
⌨️ (0:43:41) 4 - Packages, import statements, instance members, default constructor
⌨️ (0:59:01) 5 - Access and non-access modifiers
⌨️ (1:11:59) 6 - Tools: IntelliJ Idea, Junit, Maven
⌨️ (1:22:53) 7 - If/else statements and booleans
⌨️ (1:42:20) 8 - Loops: for, while and do while loop
⌨️ (1:56:57) 9 - For each loop and arrays
⌨️ (2:14:21) 10 - Arrays and enums
⌨️ (2:41:37) 11 - Enums and switch statement
⌨️ (3:07:21) 12 - Switch statement cont.
⌨️ (3:20:39) 13 - Logging using slf4j and logback
⌨️ (3:51:19) 14 - Public static void main
⌨️ (4:11:35) 15 - Checked and Unchecked Exceptions
⌨️ (5:05:36) 16 - Interfaces
⌨️ (5:46:54) 17 - Inheritance
⌨️ (6:20:20) 18 - Java Object finalize() method
⌨️ (6:36:57) 19 - Object clone method. [No lesson 20]
⌨️ (7:16:04) 21 - Number ranges, autoboxing, and more
⌨️ (7:53:00) 22 - HashCode and Equals
⌨️ (8:38:16) 23 - Java Collections
⌨️ (9:01:12) 24 - ArrayList
📺 The video in this post was made by freeCodeCamp.org
The origin of the article: https://www.youtube.com/watch?v=grEKMHGYyns&list=PLWKjhJtqVAblfum5WiQblKPwIbqYXkDoC&index=9
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#java #java 8 #learn java 8 #learn java 8 - full tutorial for beginners #beginners #java course for beginners.

Sival Alethea

Sival Alethea


Full Ethical Hacking Course - Network Penetration Testing for Beginners (2019)

Learn network penetration testing / ethical hacking in this full tutorial course for beginners. This course teaches everything you need to know to get started with ethical hacking and penetration testing. You will learn the practical skills necessary to work in the field. Throughout the course, we will develop our own Active Directory lab in Windows, make it vulnerable, hack it, and patch it. We’ll cover the red and blue sides. We’ll also cover some of the boring stuff like report writing :).
⭐️ Course Contents ⭐️
⌨️ (0:00) - Course Introduction/whoami
⌨️ (6:12) - Part 1: Introduction, Notekeeping, and Introductory Linux
⌨️ (1:43:45) - Part 2: Python 101
⌨️ (3:10:05) - Part 3: Python 102 (Building a Terrible Port Scanner)
⌨️ (4:23:14) - Part 4: Passive OSINT
⌨️ (5:41:41) - Part 5: Scanning Tools & Tactics
⌨️ (6:56:42) - Part 6: Enumeration
⌨️ (8:31:22) - Part 7: Exploitation, Shells, and Some Credential Stuffing
⌨️ (9:57:15) - Part 8: Building an AD Lab, LLMNR Poisoning, and NTLMv2 Cracking with Hashcat
⌨️ (11:13:20) - Part 9: NTLM Relay, Token Impersonation, Pass the Hash, PsExec, and more
⌨️ (12:40:46) - Part 10: MS17-010, GPP/cPasswords, and Kerberoasting
⌨️ (13:32:33) - Part 11: File Transfers, Pivoting, Report Writing, and Career Advice

📺 The video in this post was made by freeCodeCamp.org
The origin of the article: https://www.youtube.com/watch?v=3Kq1MIfTWCE&list=PLWKjhJtqVAblfum5WiQblKPwIbqYXkDoC&index=6
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#ethical hacking #network penetration testing #full ethical hacking course - network penetration testing for beginners #beginners #full ethical hacking course #network penetration testing for beginners