import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

This mixin is used to make routes accessible only if the session is authenticated. It defines a beforeModel method that aborts the current transition and instead transitions to the authenticationRoute if the session is not authenticated.

// app/routes/protected.js
          import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
          
          export default Ember.Route.extend(AuthenticatedRouteMixin);
          

Methods

source public

beforeModel(transition)

Checks whether the session is authenticated and if it is not aborts the current transition and instead transitions to the authenticationRoute. If the current transition is aborted, this method will save it in the session service's attemptedTransition property so that it can be retried after the session was authenticated (see sessionAuthenticated.

If beforeModel is overridden in a route that uses this mixin, the route's implementation must call this._super(...arguments) so that the mixin's beforeModel method is actually executed.

Arguments

transition: Transition

The transition that lead to this route

Properties

source public

authenticationRoute: String

Default: 'login'

The route to transition to for authentication. The AuthenticatedRouteMixin will transition to this route when a route that implements the mixin is accessed when the route is not authenticated.

source public readonly

session: SessionService

The session service.

Extends

Ember.Mixin

Methods