This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbookmarklet.html
28 lines (26 loc) · 4.61 KB
/
bookmarklet.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
html,body,div { margin: 0; padding: 0; font: normal 16px/24px Helvetica Neue, Helvetica, sans-serif; color: #333; }
#main { max-width: 630px; margin: 3em auto; }
.bookmarklet { display: inline-block; padding: .5em 1em; color: #fff; background: #50dcf3; border-radius: 4px; text-decoration: none; }
a { color: #50dcf3; }
.dim { color: #999; }
</style>
</head>
<body>
<div id="main">
<h1>AWS Temporary Credentials Bookmarklet</h1>
<p>
Drag this button to your bookmarks bar to save it as a bookmarklet:
</p>
<p>
<a class="bookmarklet" href="javascript:(function()%7B%22use%20strict%22%3Bvar%20link%3Bdocument.getElementById(%22bookmarklet__style_43b5427%22)%7C%7C((link%3Ddocument.createElement(%22link%22)).id%3D%22bookmarklet__style_43b5427%22%2Clink.rel%3D%22stylesheet%22%2Clink.href%3D%22https%3A%2F%2Fcode.jquery.com%2Fui%2F1.12.1%2Fthemes%2Fbase%2Fjquery-ui.min.css%22%2Cdocument.body.appendChild(link))%3B%22use%20strict%22%3Bfunction%20callback()%7Bfunction%20e()%7Bfunction%20e()%7Bvar%20i%3DjQuery.noConflict()%3Bi(document).ready(function()%7Bi(%22fieldset%22).before('%3Cdiv%20id%3D%22dialog%22%20title%3D%22AWS%20Credentials%22%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cp%3ECopy%20and%20paste%20the%20following%20commands%20into%20your%20shell%20to%20set%20up%20your%20AWS%20CLI%20environment%20variables.%3C%2Fp%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cpre%20style%3D%22white-space%3A%20pre-wrap%3Bword-wrap%3A%20break-word%3Bpadding%3A%201rem%3B%22%3ELoading...%3C%2Fpre%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cbutton%20id%3D%22copyBtn%22%20type%3D%22button%22%20class%3D%22click-to-copy%22%3EClick%20to%20copy%3C%2Fbutton%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%2Fdiv%3E')%2Ci(%22%23dialog%22).dialog(%7BautoOpen%3A!1%2Cwidth%3A%22600px%22%7D)%2Ci(%22div.saml-role%22).each(function(e%2Ct)%7Bi(%22label%22%2Ct).before('%3Cbutton%20type%3D%22button%22%20class%3D%22showTempCredsButton%22%20style%3D%22margin-right%3A%2010px%3B%22%20id%3D%22showTempCreds_'%2Be%2B'%22%3EShow%20Temporary%20Credentials%3C%2Fbutton%3E')%7D)%3Bvar%20d%3Di('%23saml_form%20input%5Bname%3D%22SAMLResponse%22%5D').first().val()%3Bi(%22button.showTempCredsButton%22).click(function(e)%7Bi(%22%23dialog%22).dialog(%22open%22)%2Ci(%22%23dialog%20pre%22).first().html(%22Loading...%22)%3Bvar%20t%3Di(%22input%22%2C%24(this).parent()).first().val()%2Ca%3Datob(d)%2Co%3Dnew%20RegExp(%22%3E(%3F%3Cprovider%3Earn%3Aaws%3Aiam%3A%3A%5C%5Cd%2B%3Asaml-provider%2F%5C%5CS%2B)%2C%22%2Bt%2B%22%3C%22)%2Cn%3Da.match(o).groups.provider%2Cr%3Dnew%20AWS.STS%2Cs%3D%7BDurationSeconds%3A3600%2CPrincipalArn%3An%2CRoleArn%3At%2CSAMLAssertion%3Ad%7D%3Br.assumeRoleWithSAML(s%2Cfunction(e%2Ct)%7Bvar%20a%3Be%3F(console.log(e%2Ce.stack)%2Ci(%22%23dialog%20pre%22).first().html(%22Error%3A%20%22%2Be.message))%3A(a%3D'export%20AWS_ACCESS_KEY_ID%3D%22'%2Bt.Credentials.AccessKeyId%2B'%22%20%5Cnexport%20AWS_SECRET_ACCESS_KEY%3D%22'%2Bt.Credentials.SecretAccessKey%2B'%22%20%5Cnexport%20AWS_SESSION_TOKEN%3D%22'%2Bt.Credentials.SessionToken%2B'%22%20%5Cnexport%20AWS_DEFAULT_REGION%3Dca-central-1%20%5Cn'%2Ci(%22%23dialog%20pre%22).first().html(a)%2Ci(%22%23dialog%22).on(%22click%22%2C%22%23copyBtn%22%2Cfunction()%7Bvar%20e%3D%24(%22%23dialog%20pre%22).text()%2Ct%3D%24(%22%3Ctextarea%3E%22)%3Bi(%22body%22).append(t)%2Ct.val(e).select()%2Cdocument.execCommand(%22copy%22)%2Ct.remove()%7D))%7D)%7D)%7D)%7Dvar%20t%3Ddocument.createElement(%22script%22)%3Bt.addEventListener%3Ft.addEventListener(%22load%22%2Ce%2C!1)%3At.readyState%26%26(t.onreadystatechange%3De)%2Ct.src%3D%22https%3A%2F%2Fsdk.amazonaws.com%2Fjs%2Faws-sdk-2.663.0.min.js%22%2Cdocument.body.appendChild(t)%7Dvar%20t%3Ddocument.createElement(%22script%22)%3Bt.addEventListener%3Ft.addEventListener(%22load%22%2Ce%2C!1)%3At.readyState%26%26(t.onreadystatechange%3De)%2Ct.src%3D%22https%3A%2F%2Fcode.jquery.com%2Fui%2F1.12.1%2Fjquery-ui.js%22%2Cdocument.body.appendChild(t)%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.addEventListener%3Fs.addEventListener(%22load%22%2Ccallback%2C!1)%3As.readyState%26%26(s.onreadystatechange%3Dcallback)%2Cs.src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F3.5.1%2Fjquery.min.js%22%2Cdocument.body.appendChild(s)%3B%7D)()">AWS Temporary Credentials Bookmarklet</a>
</p>
<p class="dim">This page was created with the <a href="https://github.com/mrcoles/bookmarklet">bookmarklet</a> npm library.</p>
</div>
</body>
</html>