-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
83 lines (75 loc) · 3.98 KB
/
index.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<html>
<head>
<title>Office 365 smart link generator (SAML IdP)</title>
<script src="https://code.jquery.com/jquery-2.2.2.min.js" integrity="sha256-36cp2Co+/62rEAAYHLmRCPIych47CvdM+uTBJwSzWjI=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<style>
.output { display: none; }
#generate-form li {
list-style-type: none;
margin-bottom: 1em;
}
.input-domain, .input-link, .input-hint {
font-weight: bold;
}
.input-domain {
color: purple;
}
.input-link {
color: orange;
}
.input-hint {
color: green;
}
input[type=text] { width: 95%; }
</style>
<script>
$( document ).ready(function() {
$('#generate-form').on('submit', function() {
var smartLink = 'https://login.microsoftonline.com/login.srf?wa=wsignin1.0';
smartLink += '&whr=' + encodeURIComponent($('#domain').val());
smartLink += '&wreply=' + encodeURIComponent($('#link').val());
if ($('#hint').is(':checked')) {
smartLink += '&login_hint=' + encodeURIComponent($('#domain').val());
}
$('#generated-output').val(smartLink);
$('#generated-link').text(smartLink).attr('href', smartLink);
$('.output').show();
return false; // prevent submit
});
});
</script>
</head>
<body>
<div class="container">
<h1>Office 365 smart link generator for a SAML IdP</h1>
<p>Linking to an Office 365 resource (e.g. SharePoint site) won't initiate single sign-on automatically.
That's where smart links come in. A smart link is your realm and your resource address encoded in a login URL.</p>
<p>This generator is useful for Office 365 instances that are configured for SAMLP authentication.
For ADFS WS-federation, see <a href="http://sbrickey.com/Tech/Blog/Post/Office_365_Smart_Link_to_a_specific_URL">Scott Brickey's blog</a>,
<a href="https://community.office365.com/en-us/w/sso/358-using-smart-links-or-idp-initiated-authentication-with-office-365">Microsoft's wiki</a> and
<a href="http://travisspencer.com/stash/o365-smart-link.html">Travis Spencer's generator</a>.</p>
<p>The generator includes optional handling for <strong>session collisions</strong>, where existing O365 sessions in other realms may exist and
you want to initiate a new session with your realm. Without the <code>login_hint</code> parameter, O365 appears to use an existing session which usually means
you'll run into a "User not in directory" issue (currently a "That didn't work" page). With the <code>login_hint</code> parameter, you should at least
get presented with a choice between the existing sessions and the new one.</p>
<p>Format: <code>https://login.microsoftonline.com/login.srf?wa=wsignin1.0&whr=<span class="input-domain">[1]</span>&wreply=<span class="input-link">[2]</span>&login_hint=<span class="input-hint">[3]</span></code></p>
<form id="generate-form">
<ol>
<li><span class="input-domain">[1]</span> <code>whr</code>: Home Realm, aka domain
<br /><input id="domain" type="text" placeholder="whr, i.e. your.domain.name"></li>
<li><span class="input-link">[2]</span> <code>wreply</code>: URL we want to redirect to
<br /><input id="link" type="text" placeholder="wreply, i.e. your link"></li>
<li><span class="input-hint">[3]</span> <code>login_hint</code>: Hint the Home Realm domain (from <span class="input-domain">[1]</span>) if we are expecting collisions with other O365 sessions
<br /><input id="hint" type="checkbox" value="1" checked></li>
</ol>
<p><input type="submit" value="Generate"></p>
</form>
<div class="output">
<p><input id="generated-output" type="text"></p>
<p><a id="generated-link" href="#"></a></p>
</div>
</div>
</body>
</html>