Skip to content

Instantly share code, notes, and snippets.

@anil477
anil477 / comparator.java
Created June 27, 2017 06:53
Using Comparator to specify custom sorting - 2
// Check this also https://gist.github.com/anil477/da64f09ddd9323c9858f86eaffe9610b
import java.util.*;
class Employee implements Comparable<Employee> {
private String name;
private int age;
private int salary;
public Employee(String name, int age, int salary) {
@mziwisky
mziwisky / Oauth2.md
Last active February 15, 2024 23:31
Oauth2 Explanation

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.