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 / env-start.ps1
Last active June 10, 2023 05:50
Environment Start Stop Automation Runbooks | Powershell
# Following automation variables should be created under respective automation account
$AksClusterName = Get-AutomationVariable -Name 'av-aks-cluster-name'
$AksClusterResourceGroup = Get-AutomationVariable -Name 'av-aks-cluster-resource-group'
function Login-ToAzure {
Disable-AzContextAutosave -Scope Process | Out-Null
try {
$AzureContext = (Connect-AzAccount -Identity).Context
} catch {
@athiththan11
athiththan11 / JITRoleProvisioningHandler.java
Created July 7, 2021 06:12
Extended JIT Provisioning Handler to assign Roles in WSO2 API Manager
package com.sample.handlers;
import java.util.List;
import java.util.Map;
import org.wso2.carbon.identity.application.authentication.framework.exception.FrameworkException;
import org.wso2.carbon.identity.application.authentication.framework.handler.provisioning.impl.SystemRolesRetainedProvisionHandler;
import org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants;
/**
@athiththan11
athiththan11 / package.json
Created June 12, 2020 19:05
Mock HTTP Socket NodeJS
{
"name": "socket-http",
"version": "1.0.0",
"description": "a simple http socket server",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "athiththan11",
"license": "ISC"
@athiththan11
athiththan11 / oauth2-enhanced-sequence.xml
Last active January 12, 2021 20:37
WSO2 API Manager & OAuth2 Protected Endpoint (with Registry Resource to store and retrieve the tokens)
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="oauth2-enhanced-sequence" xmlns="http://ws.apache.org/ns/synapse">
<!-- retreiving the access token and the generated time if exists in the registry location -->
<property name="stored-token" expression="get-property('registry', 'gov:/oauth_endpoint/access_token')" scope="default" type="STRING" />
<property name="generated-time" expression="get-property('registry', 'gov:/oauth_endpoint/generated_time')" scope="default" type="LONG" />
<!-- token generation to the oauth server's token endpoint -->
<!-- add the base64 encoded credentials -->
<property name="client-authorization-header" scope="default" type="STRING" value="MDZsZ3BTMnh0enRhOXBsaXZGUzliMnk4aEZFYTpmdE4yWTdLcnE2SWRsenBmZ1RuTVU1bkxjUFFh" />
<property name="request-body" expression="json-eval($)" scope="default" type="STRING" />
@athiththan11
athiththan11 / oauth2-sequence.xml
Last active March 22, 2020 14:04
WSO2 API Manager & OAuth2 Protected Endpoint (Simple Mediation Sequence)
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="oauth2-sequence" xmlns="http://ws.apache.org/ns/synapse">
<!-- token generation to the oauth server's token endpoint -->
<!-- add the base64 encoded credentials -->
<property name="client-authorization-header" scope="default" type="STRING" value="MDZsZ3BTMnh0enRhOXBsaXZGUzliMnk4aEZFYTpmdE4yWTdLcnE2SWRsenBmZ1RuTVU1bkxjUFFh" />
<property name="request-body" expression="json-eval($)" scope="default" type="STRING" />
<property name="resource" expression="get-property('axis2', 'REST_URL_POSTFIX')" scope="default" type="STRING" />
<!-- creating a request payload for client_credentials -->
<payloadFactory media-type="xml">
@athiththan11
athiththan11 / MyAPIMTokenIssuer.java
Last active December 25, 2019 11:59
Custom APIMTokenIssuer Implementation: Append Custom Value to the Generated Access Token
package com.sample.token;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.model.Application;
import org.wso2.carbon.apimgt.impl.APIConstants;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.apimgt.keymgt.issuers.APIMTokenIssuer;
import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext;
import org.wso2.carbon.identity.oauth2.model.RequestParameter;
Something:
type: object
required:
- something
- message
properties:
something:
type: integer
format: int32
message:
@athiththan11
athiththan11 / wso2-trilogy-apim-curl.http
Last active September 24, 2019 09:18
APIM CURL Commands for WSO2 Trilogy Medium
@consumer-key = <Replace with Consumer Key>
@consumer-secret = <Replace with Consumer Secret>
@api-hostname = https://10.100.5.220:8244/dev-management/v1.0.0
# Username & Password
@api-username = admin
@api-password = admin
@username = athiththan11
@athiththan11
athiththan11 / wso2-trilogy-ei-curl.http
Created September 1, 2019 06:14
EI CURL Commands for WSO2 Trilogy Medium
@hostname = https://localhost:8243/dev-management
@username = athiththan11
### Get Developer
# @name getDeveloper
curl -k -X GET {{hostname}}/devs/{{username}} \
-H "Content-Type: application/json"
### Get Repos of a Developer
# @name getRepos
@athiththan11
athiththan11 / strategy.js
Last active July 14, 2019 06:00
Updated passport-saml strategy with certificates
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>,