Readings: Authentication
Review, Research, and Discussion
- Explain what a “Singleton” is (in Computer Science terms)
- The singleton pattern is a software design pattern that restricts the instantiation of a class to one “single” instance. This is useful when exactly one object is needed to coordinate actions across the system. The term comes from the mathematical concept of a singleton.
-
For further information clicks =>here
- Explain how the Singleton pattern can be used with Node modules, specifically with classes
- We should add a constructor to our singleton class. And what we want to do within this constructor is we want to check and see if an instance has already been created. So we are going to save the instance directly to the class. So if there’s not a singleton instance then we want to create one. So if we don’t have one then the singleton instance will equal new logger. So that’s our singleton. And it will only allow us to create one instance whenever we instantiate this singleton class.
- So the next thing we’re going to do for a classical singleton is actually return that instance using a get instance method. And what we can do within this method is return our singleton instance. There we go. So this class only allows us to instantiate one logger and then using the get instance method we can return that logger to any file that wants to use it.
-
For further information clicks =>here
- If you were tasked with building a middleware system like Express uses, what approach might you take to construct/operate it?
- Middleware is generally pretty flexible. Some middleware is passive such as logging middleware. Other middleware such as gzip compression can perform transforms on the request or response body. Middleware can add HTTP headers, add internal flags for use by your business logic, etc. It’s an implementation of the pipelines design pattern.
-
For further information clicks =>here
Vocabulary
- Router Middleware
- The term is composed of 2 words router and middleware
- Middleware
- It is a piece of code that comes in the middle of request and response. It kind of hijacks your request so that you can do anything that you want with your request or response eg: Modify the data or call the next middleware. Middleware functions are functions that have access to the request object (req), the response object (res), and the next middleware function in the application’s request-response cycle
- Router
- In Express, usually, we make end-points that uses HTTP verbs to denote a GET POST DELETE PUT etc requests. Router is used to manage these incoming requests. It kind of routes your requests to correct handler/code
-
For further information clicks =>here
- Middleware
- The term is composed of 2 words router and middleware
- Dynamic Module Loading
- Dynamic loading is a mechanism by which a computer program can, at run time, load a library (or other binary) into memory, retrieve the addresses of functions and variables contained in the library, execute those functions or access those variables, and unload the library from memory.
-
For further information clicks =>here
- Singleton Pattern
- In software engineering, the singleton pattern is a software design pattern that restricts the instantiation of a class to one “single” instance. This is useful when exactly one object is needed to coordinate actions across the system. The term comes from the mathematical concept of a singleton.
-
For further information clicks =>here
- CRUD -> REST Method Matches
- REST, or REpresentational State Transfer, is an architectural style for providing standards between computer systems on the web, making it easier for systems to communicate with each other. REST-compliant systems, often called RESTful systems, are characterized by how they are stateless and separate the concerns of client and server. We will go into what these terms mean and why they are beneficial characteristics for services on the Web.
-
For further information clicks =>here
- Mock Testing
- Is an approach to unit testing that lets you make assertions about how the code under test is interacting with other system modules. In mock testing, the dependencies are replaced with objects that simulate the behaviour of the real ones.
-
For further information clicks =>here
Preparation
- Securing Passwords
- Passwords are the first line of defense against cyber criminals. It is the most vital secret of every activity we do over the internet and also a final check to get into any of your user account, whether it is your bank account, email account, shopping cart account or any other account you have.
- Cryptographic hash algorithms MD5, SHA1, SHA256, SHA512, SHA-3 are general purpose hash functions, designed to calculate a digest of huge amounts of data in as short a time as possible. Hashing is the greatest way for protecting passwords and considered to be pretty safe for ensuring the integrity of data or password.
-
For further information clicks =>here
- Basic Auth
- In the context of an HTTP transaction, basic access authentication is a method for an HTTP user agent (e.g. a web browser) to provide a user name and password when making a request. In basic HTTP authentication, a request contains a header field in the form of
Authorization: Basic <credentials>
, where credentials is the Base64 encoding of ID and password joined by a single colon :. -
For further information clicks =>here
- In the context of an HTTP transaction, basic access authentication is a method for an HTTP user agent (e.g. a web browser) to provide a user name and password when making a request. In basic HTTP authentication, a request contains a header field in the form of
- OWASP auth cheatsheet
- Authentication is the process of verifying that an individual, entity or website is whom it claims to be. Authentication in the context of web applications is commonly performed by submitting a username or ID and one or more items of private information that only a given user should know.
- Session Management is a process by which a server maintains the state of an entity interacting with it. This is required for a server to remember how to react to subsequent requests throughout a transaction. Sessions are maintained on the server by a session identifier which can be passed back and forward between the client and server when transmitting and receiving requests.
-
For further information clicks =>here