Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismcleod committed Oct 15, 2022
2 parents 77824b7 + e78b01a commit 36d8c48
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
8 changes: 8 additions & 0 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
</intent-filter>
</activity>

<activity
android:name="com.auth0.android.provider.RedirectActivity"
tools:node="remove"/>

<activity
android:name="com.auth0.android.provider.AuthenticationActivity"
tools:node="remove"/>

</application>

<queries>
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export {TimeoutError} from './src/utils/fetchWithTimeout';
export {default as useAuth0} from './src/hooks/use-auth0';
export {default as Auth0Provider} from './src/hooks/auth0-provider';
export {default as LAPolicy} from './src/credentials-manager/la-policies';

import Auth0 from './src/auth0';
export default Auth0;
8 changes: 8 additions & 0 deletions src/credentials-manager/la-policies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
deviceOwnerAuthenticationWithBiometrics: 1,
deviceOwnerAuthentication: 2,
deviceOwnerAuthenticationWithWatch: 3,
deviceOwnerAuthenticationWithBiometricsOrWatch: 4,
deviceOwnerAuthenticationWithWristDetection: 5,
deviceOwnerAuthenticationWithBiometrics: 6
}
10 changes: 6 additions & 4 deletions src/hooks/__tests__/use-auth0.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import Auth0Provider from '../auth0-provider';
import useAuth0 from '../use-auth0';
import { LAPolicy } from '../../..';

function makeJwt(claims) {
const header = {alg: 'RS256', typ: 'JWT'};
Expand Down Expand Up @@ -155,7 +156,7 @@ describe('The useAuth0 hook', () => {

expect(mockAuth0.webAuth.authorize).toHaveBeenCalledWith({
scope: 'openid profile email',
});
}, undefined);
});

it('adds the default scopes when some are specified with custom scope', async () => {
Expand All @@ -167,7 +168,7 @@ describe('The useAuth0 hook', () => {

expect(mockAuth0.webAuth.authorize).toHaveBeenCalledWith({
scope: 'custom-scope openid profile email',
});
}, undefined);
});

it('does not duplicate default scopes', async () => {
Expand All @@ -185,7 +186,7 @@ describe('The useAuth0 hook', () => {
scope: 'openid profile email',
audience: 'http://my-api',
customParam: '1234',
});
}, undefined);
});

it('sets the user prop after authorizing', async () => {
Expand Down Expand Up @@ -336,11 +337,12 @@ describe('The useAuth0 hook', () => {
'description',
'cancel',
'fallback',
LAPolicy.deviceOwnerAuthentication
);

expect(
mockAuth0.credentialsManager.requireLocalAuthentication,
).toHaveBeenCalledWith('title', 'description', 'cancel', 'fallback');
).toHaveBeenCalledWith('title', 'description', 'cancel', 'fallback', LAPolicy.deviceOwnerAuthentication);
});

it('dispatches an error when requireLocalAuthentication fails', async () => {
Expand Down

0 comments on commit 36d8c48

Please sign in to comment.