Posts

Assignments and Grades integration in Moodle LMS - LTI 1.3 (With client_credentials base OAuth 2.0)

Image
Moodle is the world’s most popular and most used learning management system. It’s easy to see why, the Moodle Learning Management System (LMS) is a flexible, open-source, and free to download learning management solution. This article describes how we need to work with moodle APIs in order to manipulate assignments and grades. These details are specific to LTI 1.3 standards and using client credential base OAuth 2.0 In LTI 1.3 flow, the main part is OAuth 2.0. When we work with moodle APIs, it needs to send the access token along with each API call. That means before work with the end-points we have to have the access token with us. This article specifies the client credential base assess token and to get that access token we need an external tool in Moodle LMS.  Let's see the process step by step....  This process can be divided into three parts.  Create an external tool in Moodle.  Generate access token. Manipulate assignments and grade APIs.  1) Create an ext...

OAuth

Image
OAuth 2.0 framework to consume Google API service..... What is OAuth ?? OAuth (Open Authorization) is an open protocol that provides secure API authorization from applications in a simple and standardized way. OAuth can authorize access to resources without revealing user credentials to apps. Apps that use OAuth can also directly authenticate and access Sales-force resources without a user’s presence OAuth is sometimes described as a valet key for the web. A valet key restricts access to a car. A person can drive it, but can’t use the key to open the trunk or glove box. In the same way, OAuth gives a client application restricted access to your data on a resource server. To allow access, an authorization server grants tokens to the client app in response to an authorization. How to use it to store a file in Google Drive? First things first, You will need OAuth 2.0 client credentials from Google API. Then your client application requests an access token ...

Cross Site Request Forgery Protection

Image
Cross Site Request Forgery Protection PHP web application What is CSRF (Cross Site Request Forgery protection) ?  Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application. In this blog I will be discuss about two prevention methods for CSRF.   ...
Image
Important New Features in java 8...... 1) forEach() method in Iterable interface Whenever we need to traverse through a Collection, we need to create an  Iterator  whose whole purpose is to iterate over and then we have business logic in a loop for each of the elements in the Collection. We might get  ConcurrentModificationException  if iterator is not used properly. Java 8 has introduced  forEach  method in  java.lang.Iterable  interface so that while writing code we focus on business logic only.  forEach  method takes  java.util.function.Consumer  object as argument, so it helps in having our business logic at a separate location that we can reuse. Let’s see forEach usage with simple example. 2) default and static methods in Interfaces If you read forEach method details carefully, you will notice that it’s defined in Iterable interface but we know that interfaces can’t have method body. Fro...