Skip to content

Instantly share code, notes, and snippets.

@danmilleruk
Created August 4, 2020 09:52
Show Gist options
  • Save danmilleruk/22f639cc3e1378661d1765cc4da00f52 to your computer and use it in GitHub Desktop.
Save danmilleruk/22f639cc3e1378661d1765cc4da00f52 to your computer and use it in GitHub Desktop.
Tampermonkey script to add a search box to the AWS SAML login screen
// ==UserScript==
// @name AWS Shib SSO Search
// @namespace signin.aws.amazon.com
// @description Provides SAML search functionality
// @include https://signin.aws.amazon.com/saml
// @version 1
// @grant none
// ==/UserScript==
$('fieldset').before('<div id="searchbox"><input type="text" placeholder="Account Search..."></div>');
$('#searchbox > input').css('width', '100%');
$('#searchbox > input').css('margin', '10px');
$('#searchbox > input').css('border-radius', '15px');
$('#searchbox > input').css('padding', '10px');
$('#searchbox > input').css('border', '1px #CCC solid');
$('#searchbox > input').focus();
$('#searchbox > input').keyup(function(){
if ($(this).val() == '') {
$('fieldset > div.saml-account').show();
} else {
var keyword = $(this).val();
$('fieldset > div.saml-account').each(function(){
var accountName = $(this).find('.saml-account-name').text();
if (accountName.indexOf(keyword) == -1) {
$(this).hide();
} else {
$(this).show();
}
})
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment