Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@entur/auth-provider

Package Overview
Dependencies
Maintainers
13
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@entur/auth-provider - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

1

dist/AuthProvider.d.ts
import React from 'react';
import { Auth0Config } from './typings';
interface Props {

@@ -3,0 +4,0 @@ keycloakConfigUrl?: string;

3

dist/common.d.ts
import React from 'react';
import { Auth, User } from './typings';
export declare const defaultAuthState: {

@@ -11,2 +12,2 @@ isLoading: boolean;

};
export declare const AuthContext: React.Context<Auth>;
export declare const AuthContext: React.Context<Auth<User>>;
export { AuthProvider as default } from './AuthProvider';
export declare const useAuth: () => Auth;
export declare const useAuth: () => import("./typings").Auth<import("./typings").User>;

@@ -18,22 +18,22 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

};
var AuthContext = React__default.createContext(defaultAuthState);
function createAuthContext() {
return React__default.createContext(defaultAuthState);
}
var AuthContext = createAuthContext();
var Auth0AuthProvider = function Auth0AuthProvider(_ref) {
var children = _ref.children,
claimsNamespace = _ref.claimsNamespace,
loginAutomatically = _ref.loginAutomatically;
claimsNamespace = _ref.claimsNamespace,
loginAutomatically = _ref.loginAutomatically;
var _useAuth = auth0React.useAuth0(),
isLoading = _useAuth.isLoading,
isAuthenticated = _useAuth.isAuthenticated,
user = _useAuth.user,
loginWithRedirect = _useAuth.loginWithRedirect,
getIdTokenClaims = _useAuth.getIdTokenClaims,
getAccessTokenSilently = _useAuth.getAccessTokenSilently,
logout = _useAuth.logout;
isLoading = _useAuth.isLoading,
isAuthenticated = _useAuth.isAuthenticated,
user = _useAuth.user,
loginWithRedirect = _useAuth.loginWithRedirect,
getIdTokenClaims = _useAuth.getIdTokenClaims,
getAccessTokenSilently = _useAuth.getAccessTokenSilently,
logout = _useAuth.logout;
var _useState = React.useState(),
roleAssignments = _useState[0],
setRoleAssignments = _useState[1];
roleAssignments = _useState[0],
setRoleAssignments = _useState[1];
React.useEffect(function () {

@@ -43,3 +43,5 @@ var getClaims = function getClaims() {

return Promise.resolve(getIdTokenClaims()).then(function (idTokenClaims) {
setRoleAssignments(idTokenClaims[claimsNamespace]);
if (idTokenClaims) {
setRoleAssignments(idTokenClaims[claimsNamespace]);
}
});

@@ -50,3 +52,2 @@ } catch (e) {

};
if (isAuthenticated && claimsNamespace !== undefined) {

@@ -56,3 +57,2 @@ getClaims();

}, [isAuthenticated, getIdTokenClaims]);
if (!isAuthenticated && !isLoading) {

@@ -63,3 +63,2 @@ if (loginAutomatically) {

}
return React__default.createElement(AuthContext.Provider, {

@@ -84,6 +83,6 @@ value: {

var auth0Config = _ref.auth0Config,
auth0ClaimsNamespace = _ref.auth0ClaimsNamespace,
children = _ref.children,
_ref$loginAutomatical = _ref.loginAutomatically,
loginAutomatically = _ref$loginAutomatical === void 0 ? true : _ref$loginAutomatical;
auth0ClaimsNamespace = _ref.auth0ClaimsNamespace,
children = _ref.children,
_ref$loginAutomatical = _ref.loginAutomatically,
loginAutomatically = _ref$loginAutomatical === void 0 ? true : _ref$loginAutomatical;
return React__default.createElement(auth0React.Auth0Provider, Object.assign({

@@ -90,0 +89,0 @@ useRefreshToken: true,

@@ -15,22 +15,22 @@ import React, { useState, useEffect, useContext } from 'react';

};
var AuthContext = React.createContext(defaultAuthState);
function createAuthContext() {
return React.createContext(defaultAuthState);
}
var AuthContext = createAuthContext();
var Auth0AuthProvider = function Auth0AuthProvider(_ref) {
var children = _ref.children,
claimsNamespace = _ref.claimsNamespace,
loginAutomatically = _ref.loginAutomatically;
claimsNamespace = _ref.claimsNamespace,
loginAutomatically = _ref.loginAutomatically;
var _useAuth = useAuth0(),
isLoading = _useAuth.isLoading,
isAuthenticated = _useAuth.isAuthenticated,
user = _useAuth.user,
loginWithRedirect = _useAuth.loginWithRedirect,
getIdTokenClaims = _useAuth.getIdTokenClaims,
getAccessTokenSilently = _useAuth.getAccessTokenSilently,
logout = _useAuth.logout;
isLoading = _useAuth.isLoading,
isAuthenticated = _useAuth.isAuthenticated,
user = _useAuth.user,
loginWithRedirect = _useAuth.loginWithRedirect,
getIdTokenClaims = _useAuth.getIdTokenClaims,
getAccessTokenSilently = _useAuth.getAccessTokenSilently,
logout = _useAuth.logout;
var _useState = useState(),
roleAssignments = _useState[0],
setRoleAssignments = _useState[1];
roleAssignments = _useState[0],
setRoleAssignments = _useState[1];
useEffect(function () {

@@ -40,3 +40,5 @@ var getClaims = function getClaims() {

return Promise.resolve(getIdTokenClaims()).then(function (idTokenClaims) {
setRoleAssignments(idTokenClaims[claimsNamespace]);
if (idTokenClaims) {
setRoleAssignments(idTokenClaims[claimsNamespace]);
}
});

@@ -47,3 +49,2 @@ } catch (e) {

};
if (isAuthenticated && claimsNamespace !== undefined) {

@@ -53,3 +54,2 @@ getClaims();

}, [isAuthenticated, getIdTokenClaims]);
if (!isAuthenticated && !isLoading) {

@@ -60,3 +60,2 @@ if (loginAutomatically) {

}
return React.createElement(AuthContext.Provider, {

@@ -81,6 +80,6 @@ value: {

var auth0Config = _ref.auth0Config,
auth0ClaimsNamespace = _ref.auth0ClaimsNamespace,
children = _ref.children,
_ref$loginAutomatical = _ref.loginAutomatically,
loginAutomatically = _ref$loginAutomatical === void 0 ? true : _ref$loginAutomatical;
auth0ClaimsNamespace = _ref.auth0ClaimsNamespace,
children = _ref.children,
_ref$loginAutomatical = _ref.loginAutomatically,
loginAutomatically = _ref$loginAutomatical === void 0 ? true : _ref$loginAutomatical;
return React.createElement(Auth0Provider, Object.assign({

@@ -87,0 +86,0 @@ useRefreshToken: true,

{
"name": "@entur/auth-provider",
"version": "1.1.0",
"version": "1.1.1",
"description": "React components and helpers for authentication",

@@ -66,4 +66,4 @@ "author": "entur/nrp",

"dependencies": {
"@auth0/auth0-react": "1.2.0"
"@auth0/auth0-react": "1.12.1"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc