Skip to content

Instantly share code, notes, and snippets.

View NilukaSripalim's full-sized avatar
🏢
Working From Office

Niluka Sripali Monnankulama NilukaSripalim

🏢
Working From Office
View GitHub Profile
@NilukaSripalim
NilukaSripalim / WSO2_Identity_Server_Cypress_Test_User_and_Application_Management.spec.ts
Last active April 29, 2024 16:16
This Cypress test script logs in to the WSO2 Identity Server console, creates a SCIM user, and creates an OIDC application. After each test, it deletes the created user and application to clean up the environment. The createScimUser, createApplication, deleteUser, and filterAndDeleteApplication functions handle the user and application creation …
/*
* Copyright (c) 2024 WSO2 LLC. (http://www.wso2.org)
* All rights reserved.
*
* This software is the property of WSO2 LLC. and its suppliers, if any.
* Dissemination of any information or reproduction of any material contained
* herein in any form is strictly forbidden, unless permitted by WSO2 expressly.
* You may not alter or remove any copyright or other notice from copies of this content.
*/
@NilukaSripalim
NilukaSripalim / gist:367deafcf8698af10b6d298fc2f2ec02
Created March 22, 2024 16:22
[WSO2][Asgardeo]This script ensures that only users authenticated via federation can access the application, providing an additional layer of security against unauthorized access attempts via username and password.
// Adaptive script to allow access only via federation and block access via login and password
// Error page to redirect unauthorized users,
// can be either an absolute URL or relative URL to server root, or empty/null
// null/empty value will redirect to the default error page
var errorPage = '';
// Additional query parameters to be added to the above URL.
// Hint: Use i18n keys for error messages
var errorPageParameters = {
'status': 'Unauthorized',
@NilukaSripalim
NilukaSripalim / gist:f637fd2f9020274886cfbeb3331679de
Created August 21, 2023 10:53
Asgardeo Claim Mapping via Adaptive Script
var onLoginRequest = function(context) {
executeStep(1, {
onSuccess: function(context) {
var user = context.currentKnownSubject;
user.localClaims['http://wso2.org/claims/givenname'] = "test";
user.localClaims['http://wso2.org/claims/entitlement'] = "Upon a hill, the sun does rise,Painting the world with golden skies. Nature's beauty, a gentle song, In every heart, it does belong.";
}
});
};
import ballerina/http;
import ballerina/io;
import ballerina/lang.runtime;
# A service representing a network-accessible API
# bound to port `9090`.
#
# + hasRisk - Field Description
type RiskResponse record {
boolean hasRisk;
@NilukaSripalim
NilukaSripalim / callChoreoUKIPAdaptiveScript.js
Last active November 28, 2022 11:54
Sample adaptive authentication script for callChoreo - IP address from UK
var connectionMetaData = {
"url": "https://2599de0c-00bf-49f4-b922-505be18a8677-dev.e1-us-east-azure.choreoapis.dev/iraa/testnilukaasgardeo/1.0.0/risk",
"consumerKey": "<consumer key>",
"consumerSecret": "<consumer secret>",
};
var onLoginRequest = function(context) {
executeStep(1, {
onSuccess: function (context) {
@NilukaSripalim
NilukaSripalim / Cypress Dashboard Record
Created February 27, 2022 22:43
.yml file for record Cypress dashboard from GitHub Actions
# CI name
name: Cypress GitHub Actions
# The on key is used to define when
# the CI should be triggered, aka Event
on:
# When someone push or merge a pull request
# inside the master branch
push:
branches:
@NilukaSripalim
NilukaSripalim / gist:a1d3235a28a62852ba9e1ecabe4cbf55
Created February 27, 2022 19:25
Asgardeo Sign in Cypress Test
describe('Successfully Sign-in to Asgardeo ', () => {
before(() => {
cy.window().then((win) => {
win.onbeforeunload = null;
});
// Visit Asgardeo console
cy.visit("https://dev.console.asgardeo.io/", {
onBeforeLoad: (win) => {
@NilukaSripalim
NilukaSripalim / gist:2ad9809da3d299a49749337c47c8a7e4
Last active February 27, 2022 18:22
CI with Cypress & GitHub Action
# CI name
name: Cypress GitHub Actions
# The on key is used to define when
# the CI should be triggered, aka Event
on:
# When someone push or merge a pull request
# inside the master branch
push:
branches:
@NilukaSripalim
NilukaSripalim / Variables inner for loop
Last active October 7, 2021 19:30
JavaScript Essentials
function learnJS() {
for(var i = 0 ; i < 5; i++) {
console.log(i)
}
}
learnJS();
@NilukaSripalim
NilukaSripalim / then-command.js
Created February 27, 2021 07:45
Cypress then() Example1
/// <reference types="cypress" />
describe('Cypress Test Automation with then command', () => {
const log = console.log
it('then functionality example', () => {
/**
* then() calls the passed anonymous functions
*/
cy.then(() => log("The basic with then command"));