Giter Club home page Giter Club logo

atlast-okta's Introduction

At last! Okta!

A userscript that fixes the post-sign-on Okta redirect for Jira and Confluence.

Background

The session timer for Confluence and Jira is way shorter than the amount of time an Okta cookie lasts. Because of this, Jira and Confluence will frequently kick you out of whatever page you were looking at and send you to the sign-in page. Then, you have to click the blue "Log in with Okta" button. This will load the Okta SAML login page which tends to just flash briefly before redirecting back to Jira or Confluence. That's all well and good. However, with the current way Okta is configured, I don't get redirected back to the page I was looking at. I find this immensely irritating. So much so that I've finally done something about it.

The name of the script, atlast-okta is a combination of Atlassian, the phrase "at last", and Okta.

Installation

These installation instructions only apply if you're using Google Chrome. However, everything should be the same if you're using Firefox. Just use GreaseMonkey instead of Tampermonkey.

  1. Install Tampermonkey from the Chrome Web Store. (Click here and click the blue "Add to Chrome" button. Click the "Add extension" button in the prompt that appears.)
  2. Tampermonkey will open a tab letting you know it was successfully installed. Feel free to close that tab.
  3. Install the script by clicking here. A new tab should open that displays the script. Click the install button near the top left of the screen.
  4. ????
  5. PROFIT!!!

Usage

There's nothing you need to do after you install the script. If you want to make sure it's working, sign out of Jira and then visit one of your Jira bookmarks. You should see the usual "Welcome to Jira" login screen. Click "Log in with Okta". If the script is working, you should be directed back to wherever your bookmark was supposed to take you after signing in as opposed to being dumped at the Jira home screen.

atlast-okta's People

Contributors

incplusplus avatar

Watchers

 avatar  avatar

atlast-okta's Issues

Find a better way of getting the destination page

#3, #4, and all of the weird specifics for the Confluence implementation have demonstrated that depending on Jira and Confluence to have RelayState or os_destination present and correct is not ideal. It's used inconsistency and sometimes isn't even set.

To solve this, I think it might be ideal to change how the script approaches the issue of knowing where the user was before they were redirected. It seems that it was foolish to believe that Jira and Confluence would consistently tell me where the user was. It would be better to just have the script keep track of it on its own by keeping the last loaded page URL in the session storage.

One issue I see with this approach is if I was to only record what page the user was on, it would require the Jira/Confluence page to have loaded before the user is directed to a login screen. While this would account for a case like #4, it would not account for cases where a user clicked a bookmark and was immediately taken to the login screen. It seems I need to take a mixed approach to the logic. Alternatively, I could choose to keep the script's current approach and only use this new method in cases like #4 where RelayState isn't set but there was a page the user was just on.

Note to self: This warrants a major version increase.

Load faster!

After signing into Okta and returning to Jira or Confluence, it can take upwards of a second or two to be redirected to the correct page. This is kind of bothersome to watch. Investigate if using // @run-at document-start in the userscript metadata reduces this waiting time.

Handle when Jira kicks you out of the RapidBoard page

When looking at, say, the active sprints page (which begins with /secure/RapidBoard.jspa), if the session expires two things can happen.

  1. There will be a prompt at the top right of the screen saying you need to log in again. If you click this, the RelayState parameter will be set (although it won't start with a slash for some reason which is now accounted for in #3).
  2. You will be instantly redirected to the login page and RelayState won't be set so there's no way for the script to be aware that the user was just forced to the login page. That means that in its current state, atlast-okta has no way to help with this.

Number two seems to happen to me much more frequently which makes this pretty annoying.

Jira dashboard links are not properly redirected

If I try to visit https://jira.ExampleCompany.com/secure/Dashboard.jspa?selectPageId=12345, I am redirected to https://jira.ExampleCompany.com/okta_login.jsp?RelayState=/secure/Dashboard.jspa. Userscripts aren't able to intercept an HTTP 301/302 redirect. So, the script is only able to begin running once the Okta sign-in page is reached. However, the URL at that point no longer has the page ID that the user should be returned to.

Because of this, a useless redirect occurs after the user finishes signing in as they are redirected back to the dashboard on no specific page. It's unfortunately not possible to work around this without turning this project into a chrome extension. As such, I'll leave this bug open as wontfix as this is a problem on Atlassian's end.

The only thing I can do is detect if something like this happens and avoid adding a bit of delay to the page load by redirecting to the same exact page that the user is on. This could be detected by checking if the intended destination page is the same as the current URL.

Action items:

  • Detect if a redirect is useless and, if so, don't bother redirecting the user
  • Update the README with a limitations section that describes this issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.