API Docs for: 0.25.0
Show:

File: addon/mixins/osf-agnostic-auth-route.js

  1. import Ember from 'ember';
  2. import config from 'ember-get-config';
  3.  
  4. import OsfTokenLoginRoute from '../mixins/osf-token-login-route';
  5. import OsfCookieLoginRoute from '../mixins/osf-cookie-login-route';
  6.  
  7. /**
  8. * @module ember-osf
  9. * @submodule mixins
  10. */
  11.  
  12. var AuthMixin;
  13.  
  14. let authType = config.authorizationType;
  15. if (authType === 'token') {
  16. AuthMixin = OsfTokenLoginRoute;
  17. } else if (authType === 'cookie') {
  18. AuthMixin = OsfCookieLoginRoute;
  19. } else {
  20. throw new Ember.Error(`Unrecognized authorization type: ${authType}`);
  21. }
  22. /**
  23. * Route mixin for authentication-agnostic login: defines the application at runtime to use the authentication method
  24. * specified in environment config. Intended to be used in tandem with OsfAgnosticAuthRoute mixin.
  25. * Some authentication methods (eg cookies) are not available to third-party applications.
  26. * This has limited use, since most applications will only need to support one method. It may be useful for ember apps
  27. * that run inside the OSF, eg to use the standalone dev server, or to offer support for branded apps
  28. * on third-party domains.
  29. *
  30. * @class OsfAgnosticAuthRoute
  31. * @extends Ember.Mixin
  32. * @uses ember-osf/OsfCookieLoginRoute
  33. * @uses ember-osf/OsfTokenLoginRoute
  34. */
  35. export default AuthMixin;
  36.