Right now, I am using elastic/kibana 7.8 OSS version code
I am trying to implement authentication using Google auth by developing a plugin.
Now for protecting routes, how to listen to route changes in kibana from a plugin
for detecting route change we implemented that in following way by adding isAuth() in src/core/public/application/app_router.tsx file:
{[...mounters]
// legacy apps can have multiple sub-apps registered with the same route
// which needs additional logic that is handled in the catch-all route below
.filter(([_, mounter]) => !mounter.legacy)
.map(([appId, mounter]) => (
<Route
key={mounter.appRoute}
path={mounter.appRoute}
render={({ match: { url } }) =>
isAuth() ? (
<AppContainer
appPath={url}
appStatus={appStatuses.get(appId) ?? AppStatus.inaccessible}
createScopedHistory={createScopedHistory}
{...{ appId, mounter, setAppLeaveHandler, setIsMounting }}
/>
) : (
<Redirect to="/app/auth" />
)
}
/>
))}
But even when user is not logged in by checking with isAuth() it is not directing to /auth route
Can anybody help me to solve this issue or provide code for authorization of routes!