Giter Site home page Giter Site logo

jbanahan / fix_microsoft_links Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spilliton/fix_microsoft_links

0.0 0.0 0.0 19 KB

Fixes redirects to login pages when a user clicks a link to your site from a Microsoft application like Word or Excell

License: MIT License

Ruby 100.00%

fix_microsoft_links's Introduction

fix_microsoft_links

Gem Version Build Status Code Climate

Experiencing redirects to login pages when a user clicks a link to your site from a Microsoft application like Word or Excel?

This gem for rails will fix that right up! Here is some background on the issue:

If a user is already authenticated to your application in their web browser and they click a link inside MS Word to a protected URL on your application that they should have access to, the Microsoft application will initially provide a different cookie than the one you are already authenticated with. This will likely cause your app to 302 the client to your app's login page. This time the browser will be using the correct cookie, authenticate the client, and likely redirect them to whatever page your app directs users to after login. This behavior is admitted to here: http://support.microsoft.com/kb/899927

fix_microsoft_links is rack middleware that checks the http user agent to see if the request is coming from a known Microsoft app. If it is, it responds with a page containing only a meta refresh header tag. Very hacky, but the easiest way around this annoyance :)

Install

# Add the following to you Gemfile
gem 'fix_microsoft_links'
# Update your bundle
bundle install

Pre-Rails 3

You will need to specify in your environment.rb file where to tie the middleware into rack since you can't Railties. Something like this should work:

# config/environment.rb ...
require 'fix_microsoft_links'
Rails::Initializer.run do |config|
# ....
  config.middleware.insert_after Rack::Lock, FixMicrosoftLinks::Rack::Response
# more init code....

Thanks

To my employer Moxie Software, that sponsored the creation of this gem :)

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.