Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luigi Authentication Events #501

Merged
merged 39 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b6f6548
Merge remote-tracking branch 'upstream/master'
maxmarkus Apr 16, 2019
70ec3f8
implemented onAuthExpired, onAuthRehydrated. refactored Luigi Core ap…
maxmarkus Apr 17, 2019
07a282a
removed styles to prevent prettier + compiler bug
maxmarkus Apr 17, 2019
97110d0
implemented onAuthError, onAuthExpired, documented custom auth provider
maxmarkus Apr 26, 2019
662f136
refactored function execution
maxmarkus Apr 26, 2019
2e6d190
auth event readme
maxmarkus Apr 29, 2019
d2702a1
unit tests for some async and auth helpers
maxmarkus Apr 29, 2019
61f9b74
Merge remote-tracking branch 'upstream/master' into 440-luigi-auth-ev…
maxmarkus Apr 29, 2019
18b3701
docu changes
maxmarkus Apr 29, 2019
e08ddd7
refactored applyFunctionPromisified
maxmarkus Apr 29, 2019
bdc7cc4
fixed implementation bug which caused onAuthExpired to be called if u…
maxmarkus Apr 30, 2019
bfd8bcb
Merge remote-tracking branch 'upstream/master'
maxmarkus May 2, 2019
20fca7b
fixed missing input parameter
maxmarkus May 2, 2019
092f11c
Merge remote-tracking branch 'upstream/master'
maxmarkus May 3, 2019
0dce248
Update docs/authorization-configuration.md
bszwarc May 3, 2019
004138b
Apply suggestions from code review
bszwarc May 3, 2019
fcae5d1
Merge branch '440-luigi-auth-events' of github.com:maxmarkus/luigi in…
maxmarkus May 3, 2019
e67c575
event docs restructuring
maxmarkus May 3, 2019
7dd79dc
Merge remote-tracking branch 'upstream/master'
maxmarkus May 7, 2019
2a3fa3b
Merge remote-tracking branch 'upstream/master' into 440-luigi-auth-ev…
maxmarkus May 7, 2019
451389e
LuigiAuth instead of LuigiConfig for auth methods
maxmarkus May 7, 2019
b4338af
refactored executeConfigFnAsync to not fail on errors by default but …
maxmarkus May 7, 2019
da486f2
Apply suggestions from code review
bszwarc May 7, 2019
e8afcd3
Merge branch '440-luigi-auth-events' of github.com:maxmarkus/luigi in…
maxmarkus May 7, 2019
2d34c8c
docu update
maxmarkus May 7, 2019
871e63d
cleaned duplicate markup
maxmarkus May 8, 2019
fea77e9
Update docs/authorization-configuration.md
bszwarc May 8, 2019
6c5a959
Merge branch '440-luigi-auth-events' of github.com:maxmarkus/luigi in…
maxmarkus May 9, 2019
512ae72
Merge remote-tracking branch 'upstream/master' into 440-luigi-auth-ev…
maxmarkus May 9, 2019
39ceebf
missing if
maxmarkus May 9, 2019
72ba4b7
refactored reason and error to error and errorDescription
maxmarkus May 10, 2019
3a3c970
onAuthError works again, small improvements to mock auth and logout.h…
maxmarkus May 10, 2019
8618032
fix unit tests
maxmarkus May 13, 2019
a8065ef
Merge remote-tracking branch 'upstream/master' into 440-luigi-auth-ev…
maxmarkus May 13, 2019
59b18c2
fix merge issue
maxmarkus May 13, 2019
1facc73
updated docu since only error and expired event respect return false
maxmarkus May 13, 2019
89a26ac
Merge remote-tracking branch 'upstream/master'
maxmarkus May 13, 2019
327772f
Merge branch 'master' into 440-luigi-auth-events
maxmarkus May 13, 2019
8af595e
revert topnav wrong merge
maxmarkus May 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Login Flow', () => {
);
});

it('Link in profile dropwdown', () => {
it('Link in profile dropdown', () => {
cy.login('tets@email.com', 'tets');

cy.get('[data-e2e="luigi-topnav-profile"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,18 @@
<div class="panel">
<h1>Login to Luigi sample app</h1>
<form>
<input type="text" class="form-input" value="LuigiUsername" /><br />
<input type="password" class="form-input" value="LuigiPassword" /><br />
<input
type="text"
class="form-input"
value="LuigiUsername"
autocomplete="username"
/><br />
<input
type="password"
class="form-input"
value="LuigiPassword"
autocomplete="current-password"
/><br />
<button id="login-button">Login</button>
</form>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<title>Luigi Mock Identity Provider</title>
</head>
<body>
Logging out...
<script>
window.onload = function() {
const redirectTo = decodeURIComponent(window.location.href.match(/post_logout_redirect_uri=(.*?)(&|$)/)[1]);
window.location.href = redirectTo;
};
</script>
</body>
<head>
<title>Luigi Mock Identity Provider</title>
</head>
<body>
Logging out...
<script>
var allPossibilitiesOfHashSlashes = '([^/?=&]+)(=([^&]*))?';

var getQueryParams = function(uri) {
var hashParams = {};
uri.replace(new RegExp(allPossibilitiesOfHashSlashes, 'g'), function(
$0,
$1,
$2,
$3
) {
hashParams[$1] = $3;
});
return hashParams;
};

window.onload = function() {
let redirectTo;
try {
const url = new URL(window.location.href);
const post_logout_redirect_uri = url.searchParams.get(
'post_logout_redirect_uri'
);
redirectTo = post_logout_redirect_uri;

const error = url.searchParams.get('error');
const errorDescription = url.searchParams.get('errorDescription');
if (error) {
redirectTo = `${redirectTo}?error=${error}&errorDescription=${errorDescription}`;
}
} catch (error) {
redirectTo = decodeURIComponent(
window.location.href.match(/post_logout_redirect_uri=(.*?)(&|$)/)[1]
);
}
window.location.href = redirectTo;
};
</script>
</body>
</html>
17 changes: 9 additions & 8 deletions core/examples/luigi-sample-angular/src/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<div class="hint" id="message" data-e2e="logout-message">Sign in again to continue working on awesome things!</div>
</p>
<p class="fd-has-text-align-center">
<button class="fd-button--emphasized " onclick="login()">Re-Login</button>
<button class="fd-button--emphasized" onclick="login()">Re-Login</button>
</p>
</section>
</div>
Expand All @@ -74,16 +74,12 @@
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(location.search);
return results && decodeURIComponent(results[1].replace(/\+/g, ' ')) || '';
};
}

var reason = getUrlParameter('reason');
var error = getUrlParameter('error');
var errorDescription = getUrlParameter('errorDescription');

if (error) {
document.getElementById('message').innerText = error;
}

switch (reason) {
switch (error) {
case 'tokenExpired':
document.getElementById('headline').innerText = 'Your session has expired.';
break;
Expand All @@ -94,6 +90,11 @@
default:
break;
}

if (errorDescription) {
document.getElementById('message').innerText = errorDescription;
}

</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,19 @@ class Auth {
};

events = {
onLogout: () => {
console.log('onLogout');
onLogout: settings => {
console.log('onLogout', settings);
},
onAuthSuccessful: data => {
console.log('onAuthSuccessful', data);
onAuthSuccessful: (settings, authData) => {
console.log('onAuthSuccessful', settings, authData);
},
onAuthExpired: () => {
console.log('onAuthExpired');
onAuthExpired: settings => {
console.log('onAuthExpired', settings);
// return false; // prevent redirect to logoutUrl
},
// TODO: define luigi-client api for getting errors
onAuthError: err => {
console.log('authErrorHandler 1', err);
onAuthError: (settings, err) => {
console.log('authErrorHandler 1', err, settings);
// return false; // prevent redirect to logoutUrl, but go to /
}
};
}
Expand Down
41 changes: 30 additions & 11 deletions core/examples/luigi-sample-vue/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading