Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be10060
commit 506f6da
Showing
10 changed files
with
156 additions
and
7 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# How do I restrict my App to specific websites? | ||
|
||
Here are some examples of URLs that you can allow to set up a referrer: | ||
|
||
- A specific URL with an exact path: www.example.com/path | ||
- Any URL in a single domain with no subdomains, using a wildcard asterisk (_): example.com/_ | ||
- Any URL in a single subdomain, using a wildcard asterisk (_): sub.example.com/_ | ||
- Any subdomain or path URLs in a single domain, using wildcard asterisks (_): _.example.com/\* | ||
- A URL with a non-standard port: www.example.com:8000/* | ||
|
||
**Note:** query parameters and fragments are not currently supported; they will be ignored if you include them in an HTTP referrer. | ||
|
||
# Example | ||
|
||
```javascript | ||
const express = require('express') | ||
const restriction = require('express-restriction') | ||
const app = express() | ||
const port = 3000 | ||
|
||
const allowedWebsites = [ | ||
'www.foo.com/path', | ||
'bar.com/*', | ||
'sub.baz.com/*', | ||
'*.qux.com/*', | ||
'www.quux.com:8000/*' | ||
] | ||
|
||
// use in whole app | ||
app.use(restriction.website(allowedWebsites)) | ||
|
||
// or use in specific routes | ||
app.get( | ||
'/', | ||
restriction.website(allowedWebsites) /* only allowed websites access here */ | ||
) | ||
|
||
app.listen(port, () => { | ||
console.log(`Example app listening at http://localhost:${port}`) | ||
}) | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Example | ||
|
||
```javascript | ||
const express = require('express') | ||
const restriction = require('express-restriction') | ||
const app = express() | ||
const port = 3000 | ||
|
||
const allowedIpAddresses = [ | ||
'192.168.0.1', | ||
'172.16.0.0/12', | ||
'2001:db8::1', | ||
'2001:db8::/64' | ||
] | ||
|
||
// use in whole app | ||
app.use(restriction.ip(allowedIpAddresses)) | ||
|
||
// or use in specific routes | ||
app.get( | ||
'/', | ||
restriction.ip(allowedIpAddresses) /* only allowed ip addresses access here */ | ||
) | ||
|
||
app.listen(port, () => { | ||
console.log(`Example app listening at http://localhost:${port}`) | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# How do I restrict my APP to specific Android applications? | ||
|
||
You can restrict APP to specific Android applications by providing a debug certificate fingerprint or a release certificate fingerprint. | ||
|
||
## Debug certificate fingerprint | ||
|
||
For Linux or macOS: | ||
|
||
```sh | ||
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android | ||
``` | ||
|
||
For Windows: | ||
|
||
```sh | ||
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android | ||
``` | ||
|
||
## Release certificate fingerprint | ||
|
||
```sh | ||
keytool -list -v -keystore your_keystore_name -alias your_alias_name | ||
``` | ||
|
||
> Replace your_keystore_name with the fully-qualified path and name of the keystore, including the .keystore extension. Replace your_alias_name with the alias that you assigned to the certificate when you created it. | ||
# Example | ||
|
||
```javascript | ||
const express = require('express') | ||
const restriction = require('express-restriction') | ||
const app = express() | ||
const port = 3000 | ||
|
||
const allowedAndroidApps = [ | ||
{ | ||
packageName: 'com.foo', | ||
signature: 'd30dac129121e16967719b6291afa16675445d75' | ||
}, | ||
{ | ||
packageName: 'com.bar', | ||
signature: '1591082628a39381544ba0c30e707c382ecae1dc' | ||
} | ||
] | ||
|
||
// use in whole app | ||
app.use(restriction.android(allowedAndroidApps)) | ||
|
||
// or use in specific routes | ||
app.get( | ||
'/', | ||
restriction.android( | ||
allowedAndroidApps | ||
) /* only allowed android apps access here */ | ||
) | ||
|
||
app.listen(port, () => { | ||
console.log(`Example app listening at http://localhost:${port}`) | ||
}) | ||
``` |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Example | ||
|
||
```javascript | ||
const express = require('express') | ||
const restriction = require('express-restriction') | ||
const app = express() | ||
const port = 3000 | ||
|
||
const bundleIdentifiers = ['com.foo', 'com.bar'] | ||
|
||
// use in whole app | ||
app.use(restriction.ios(bundleIdentifiers)) | ||
|
||
// or use in specific routes | ||
app.get( | ||
'/', | ||
restriction.ios(bundleIdentifiers) /* only allowed ios apps access here */ | ||
) | ||
|
||
app.listen(port, () => { | ||
console.log(`Example app listening at http://localhost:${port}`) | ||
}) | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
{ | ||
"01-getting-started": { | ||
"title": "Getting Started" | ||
}, | ||
"02-http-referrers": { | ||
"01-http-referrers": { | ||
"title": "HTTP Referrers" | ||
}, | ||
"03-ip-addresses": { | ||
"02-ip-addresses": { | ||
"title": "IP Addresses" | ||
}, | ||
"04-android-apps": { | ||
"03-android-apps": { | ||
"title": "Android Apps" | ||
}, | ||
"05-ios-apps": { | ||
"04-ios-apps": { | ||
"title": "iOS Apps" | ||
} | ||
} |