Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit 94cedbb

Browse files
authored
πŸ“¦οΈ πŸ”§ Epic/summer 2023 (#5)
* update ios to v11.0 and pod install * improve cryptr configs * enhance gitignore * πŸ”’ Feature/ Gateway V2 Oauth token (#6) * hotfix scope for encoding * body for universal token request * url for universal token * get universal tokens * encode query param value * adapt test to new encoded uri values * root scripts to run exmaples * fix cpp file for ios build * ensuire pod build * fix test * Feature/gateway email and domain (#8) * new component for gateway access + test * use new component on unatuhenticated view * improve test * export new component in lib * delete CryptrSSOGatewayButton components and related associations * missing deletion * delete signWithSso functions, components and related tests * add readme hooks actions * cleanup (un)authenticated views * improve test coverage * improve android build * temp ignore google for not slo * set nodejs stable version * cocoapods is updated * temp use unused variable (ts error) * Feature/upgrade-react-native-fix-vulnerabilities (#9) * upgrade react-native to version 0.63.5 * updated podfile * fix README * fix 🐚 on readme for signInWithEmail * update kotlinversion
1 parent 9a4957c commit 94cedbb

30 files changed

+6301
-1030
lines changed

β€Ž.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ coverage/
6767

6868
*.env*
6969
*cryptrConfig.local*
70+
*cryptrConfig.template.tsx

β€Ž.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 16.4.0

β€ŽREADME.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ React Native SDK for Cryptr Authentication through SSO
44

55
## Summary
66

7-
- [Expo](#expo)
7+
- [@cryptr/cryptr-react-native](#cryptrcryptr-react-native)
8+
- [Summary](#summary)
9+
- [Expo integration](#expo-integration)
810
- [Prerequisites](#prerequisites)
911
- [Android](#android)
1012
- [iOS](#ios)
@@ -14,8 +16,18 @@ React Native SDK for Cryptr Authentication through SSO
1416
- [3 - Android](#3---android)
1517
- [Usage](#usage)
1618
- [Basis](#basis)
17-
- [iOS Alert dialog](#ios-alert-dialog-on-sso-log-in)
19+
- [iOS Alert dialog on SSO log in](#ios-alert-dialog-on-sso-log-in)
1820
- [Hooks](#hooks)
21+
- [isAuthenticated](#isauthenticated)
22+
- [user](#user)
23+
- [accessToken](#accesstoken)
24+
- [idToken](#idtoken)
25+
- [signInWithDomain](#signinwithdomain)
26+
- [signInWithEmail](#signinwithemail)
27+
- [refreshTokens](#refreshtokens)
28+
- [logOut](#logout)
29+
- [error](#error)
30+
- [isLoading](#isloading)
1931
- [Components](#components)
2032

2133
## Expo integration
@@ -185,33 +197,34 @@ const { idToken } = useCryptr()
185197

186198
Actions
187199

188-
#### signinWithSSO
189-
190-
Hook action to sign in the user using a specific SSO.
191-
*Requires* `idpId` value.
200+
#### signInWithDomain
192201

202+
Hook action to sign in the user using his organization's domain.
193203

194204
```js
195-
const { signinWithSSO } = useCryptr()
196-
197-
// [...]
198-
signinWithSSO(idpID: string, successCallback?: (data: any) => any, errorCallback?: (data: any) => any)
199-
```
205+
const { signInWithDomain } = useCryptr();
200206

201-
#### signinWithSSOGateway
207+
// Signature
208+
signInWithDomain(domain?: string, successCallback? (data: any) => any, errorCallback?: (data: any) => any)
202209

203-
Hook action to sign in the user using Cryptr Gateway when you don't know what is the precise ID used by your end user. You can precise a subset of IDP_ID that the user will be able to consume if none is provided, the end-user will be able to find his by email or organziation_domain.
210+
// Sign in for domain `company-dot-io`
211+
signInWithDomain('company-dot-io')
212+
```
204213
205-
When you set one string for `idpId` behavior is the same as `signinWithSSO``
214+
πŸ’‘ If you do not provide value for `domain` user will be asked to input his email address and regarding to your organizations configuration he will be redirected to proper authentication process.
206215
207-
:warning: requires a proper setup of your different organizations
216+
#### signInWithEmail
208217
218+
Hook action to sign in the user using his business email. *Requires* `email` value.
209219
210220
```js
211-
const { signinWithSSOGateway } = useCryptr()
221+
const { signInWithEmail } = useCryptr();
212222

213-
// [...]
214-
signinWithSSOGateway(idpID?: string | string[], successCallback?: (data: any) => any, errorCallback?: (data: any) => any)
223+
// Signature
224+
signInWithEmail(email: string, successCallback? (data: any) => any, errorCallback?: (data: any) => any)
225+
226+
// Sign in for email `john@company.io`
227+
signInWithEmail('john@company.io')
215228
```
216229
217230
#### refreshTokens
@@ -264,8 +277,6 @@ const { isLoading } = useCryptr()
264277
265278
This SDK also includes Components to simplify your integration.
266279
267-
- `SsoSigInButton` to login using SSO (hides when session is already active [`autoHide={false}` to disable])
268-
269-
- `SsoGatewayButton` to login using SSO Gateway (hides when session is already active [`autoHide={false}` to disable])
280+
- `CryptrGatewayButton` to log in either with domain or email (hides when session is already active [`autoHide={false}` to disable])
270281
- `LogOutButton` to logout user (hides when no session is active [`autoHide={false}` to disable])
271282
- `RefreshButton` to get new tokens (hides when session is already active [`autoHide={false}` to disable])

β€Žandroid/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Cryptr_kotlinVersion=1.4.32
1+
Cryptr_kotlinVersion=1.5.20
22
Cryptr_compileSdkVersion=32
33
Cryptr_targetSdkVersion=32

β€Žcryptr-cryptr-react-native.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
1010
s.license = package["license"]
1111
s.authors = package["author"]
1212

13-
s.platforms = { :ios => "10.0" }
13+
s.platforms = { :ios => "11.0" }
1414
s.source = { :git => "https://cryptr.co.git", :tag => "#{s.version}" }
1515

1616
s.source_files = "ios/**/*.{h,m,mm,swift}"

β€Žexample/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<activity
1414
android:name=".MainActivity"
1515
android:label="@string/app_name"
16+
android:exported="true"
1617
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
1718
android:launchMode="singleTask"
1819
android:windowSoftInputMode="adjustResize">

β€Žexample/android/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())
23

34
buildscript {
45
ext {
@@ -20,6 +21,12 @@ buildscript {
2021
}
2122

2223
allprojects {
24+
configurations.all {
25+
resolutionStrategy {
26+
// Remove this override in 0.66, as a proper fix is included in react-native itself.
27+
force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
28+
}
29+
}
2330
repositories {
2431
mavenLocal()
2532
maven {

β€Žexample/cryptrConfig.template.tsx renamed to β€Žexample/cryptrConfig.tplt.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,3 @@ export const cryptrConfig: CryptrConfig = {
99
cryptr_base_url: 'YOUR_CRYPTR_SERVER_URL',
1010
dedicated_server: true,
1111
};
12-
13-
export const IDP_ID = 'YOUR_IDP_ID';
14-
export const IDP_ID2 = 'YOUR_SECOND_IDP_ID';

β€Žexample/ios/CryptrExample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@
137137
47F7ED3B7971BE374F7B8635 /* Pods-CryptrExample.debug.xcconfig */,
138138
E00ACF0FDA8BF921659E2F9A /* Pods-CryptrExample.release.xcconfig */,
139139
);
140-
name = Pods;
141140
path = Pods;
142141
sourceTree = "<group>";
143142
};
@@ -544,6 +543,7 @@
544543
CURRENT_PROJECT_VERSION = 1;
545544
ENABLE_BITCODE = NO;
546545
INFOPLIST_FILE = CryptrExample/Info.plist;
546+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
547547
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
548548
OTHER_LDFLAGS = (
549549
"$(inherited)",
@@ -566,6 +566,7 @@
566566
CLANG_ENABLE_MODULES = YES;
567567
CURRENT_PROJECT_VERSION = 1;
568568
INFOPLIST_FILE = CryptrExample/Info.plist;
569+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
569570
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
570571
OTHER_LDFLAGS = (
571572
"$(inherited)",

β€Žexample/ios/Podfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require_relative '../node_modules/react-native/scripts/react_native_pods'
22
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
33

4-
platform :ios, '10.0'
4+
platform :ios, '11.0'
55

66
target 'CryptrExample' do
77
config = use_native_modules!
@@ -18,4 +18,12 @@ target 'CryptrExample' do
1818
# post_install do |installer|
1919
# flipper_post_install(installer)
2020
# end
21+
22+
post_install do |installer|
23+
installer.pods_project.targets.each do |target|
24+
target.build_configurations.each do |config|
25+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
26+
end
27+
end
28+
end
2129
end

0 commit comments

Comments
Β (0)