Skip to content

Instantly share code, notes, and snippets.

View athiththan11's full-sized avatar
🤙
Revamping Engineering

Athiththan Kathirgamasegaran athiththan11

🤙
Revamping Engineering
View GitHub Profile
@athiththan11
athiththan11 / strategy.js
Last active July 10, 2019 08:29
A sample passport-saml configuration
var passport = require('passport');
var saml = require('passport-saml').Strategy;
// saml strategy for passport
var strategy = new saml(
{
entryPoint: <provide SAML entry point url : https://localhost:9443/samlsso>,
issuer: <provide SAML issuer name : SampleExpressApp>,
protocol: <provide the protocol used : http://>,
logoutUrl: <provide the logout url : https://localhost:9443/samlsso>
@athiththan11
athiththan11 / server.js
Last active July 14, 2019 06:04
Server JS implementation of the demo WSO2 SAML SSO express application
require('dotenv').config();
var path = require('path');
var fs = require('fs');
var express = require('express');
var session = require('express-session');
var passport = require('passport');
var saml = require('passport-saml').Strategy;
var bodyParser = require('body-parser');
@athiththan11
athiththan11 / package.json
Created July 6, 2019 19:10
Package.json file of the express application written for WSO2 SAML SSO demo
{
"name": "expresssaml",
"version": "1.0.0",
"description": "Express Application with SAML SSO",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "athiththan11",
"homepage": "https://github.com/athiththan11/Passport-SAML-WSO2",
@athiththan11
athiththan11 / ShopperServiceComponent.java
Created July 6, 2019 08:45
Shopper OSGi service component implementation on activation and reference to the Fabricator service component
@Component(
name = "com.sample.athiththan.shopper.internal.service",
immediate = true
)
public class ShopperServiceComponent {
private static final Logger LOGGER = Logger.getLogger(ShopperServiceComponent.class.getName());
private static FactFabricator fabricator;
@Activate
@athiththan11
athiththan11 / FactShopper.java
Created July 6, 2019 08:28
Shopper OSGi component implementation
public class FactShopper {
private static final Logger LOGGER = Logger.getLogger(FactShopper.class.getName());
public void printFacts() {
LOGGER.info("\n\nOSGI Shopper :: Print Facts retrieved from FactFabricator :: "
+ ShopperServiceComponent.getFactProducer().getSimpleFact().toString() + "\n");
}
}
@athiththan11
athiththan11 / FabricatorServiceComponent.java
Created July 6, 2019 08:24
Fabricator OSGi service component implementation containing the activation with the Bundle Context
@Component(name = "com.sample.athiththan.fabricator.internal.service", immediate = true)
public class FabricatorServiceComponent {
private static final Logger LOGGER = Logger.getLogger(FabricatorServiceComponent.class.getName());
@Activate
protected void activate(ComponentContext context) {
/**
* create a new instance inside the activate method and register the service
@athiththan11
athiththan11 / FactFabricator.java
Created July 6, 2019 08:18
OSGi Component: Fabricator implementation
public class FactFabricator {
private Fact fact = new Fact(System.getProperty("user.name"), System.getProperty("os.name"));
private static final Logger LOGGER = Logger.getLogger(FactFabricator.class.getName());
public Fact getSimpleFact() {
LOGGER.info("OSGI Fabricator :: Retrieving Simple Fact from FactFabricator Class");
return fact;
}
@athiththan11
athiththan11 / Fact.java
Last active July 6, 2019 08:17
Fabricator OSGi Component to generate and provide details about the OS and logged-in User
public class Fact {
private String username;
private String os;
public Fact(String username, String os) {
this.setUsername(username);
this.setOs(os);
}
@athiththan11
athiththan11 / identity-event.properties
Created July 6, 2019 05:32
Subscribe to the published events in Identity Event properties file
module.name.13=defectivePasswordValidator
defectivePasswordValidator.subscription.1=PRE_UPDATE_CREDENTIAL
defectivePasswordValidator.subscription.2=PRE_UPDATE_CREDENTIAL_BY_ADMIN
@athiththan11
athiththan11 / DefaultDefectivePasswordValidator.java
Created July 6, 2019 05:25
Default defective password validation method
public class DefaultDefectivePasswordValidator implements DefectivePasswordValidator {
private static List<String> crackedPasswords = new ArrayList<>();
private static DefaultDefectivePasswordValidator dPasswordValidator = new DefaultDefectivePasswordValidator();
private static final Logger log = LoggerFactory.getLogger(DefaultDefectivePasswordValidator.class);
private DefaultDefectivePasswordValidator() {
}