Skip to content

Commit 8622564

Browse files
committed
initial commit
0 parents  commit 8622564

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+19454
-0
lines changed

.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

README.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
4+
5+
## Installation
6+
7+
```console
8+
yarn install
9+
```
10+
11+
## Local Development
12+
13+
```console
14+
yarn start
15+
```
16+
17+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
## Build
20+
21+
```console
22+
yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
## Deployment
28+
29+
```console
30+
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
31+
```
32+
33+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

blog/2018-05-14-what-is-scim.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
slug: what-is-scim
3+
title: What is SCIM
4+
description: An introduction to the System for Cross-domain Identity Management.
5+
image: /img/blog/scim-card.png
6+
author: Asaf Shakarzy
7+
author_title: Core Team
8+
author_url: https://github.com/asaf
9+
tags: ["SCIM", "provisioning", "cloud"]
10+
---
11+
12+
Over the last decade, the world has beeing moving to the cloud, with legacy and on-premise applications side by side.
13+
14+
Such hybrid architecture arises many technological complexities. One of the challenges is about how to securely exchange and provision identities between the different parties.
15+
16+
SCIM standardizes how identity resources such _Users_ and _Groups_ look like and how to exchange them between the different applications.
17+
18+
<!-- truncate -->
19+
20+
By simplyfing the whole identity provisioning process, it reduce total integration costs and increase security.
21+
22+
Quote from RFC:
23+
24+
The SCIM specification is designed to manage user identity in
25+
cloud-based applications and services in a standardized way to
26+
enable interoperability, security, and scalability.
27+
28+
## Why SCIM?
29+
30+
Without SCIM, each application would have its own identities representation and protocol.
31+
32+
Special connectors would be required per application to exchange identities.
33+
34+
The lack of a standard requires a lot of effort in order to integrate and exchange identities between each two parties.
35+
36+
It is a very costly process and may lead to mistaks and complexities which impact the overall security.
37+
38+
## How SCIM works?
39+
40+
SCIM is divided into two parts: [the schema](https://tools.ietf.org/html/rfc7643) that defines how resources such as _users_ and _groups_ look like and [the protocol](https://tools.ietf.org/html/rfc7644) that defines how those resources should be exchanged (_added_, _removed_, _updated_ and so on).
41+
42+
SCIM is built for the cloud and is based on standard cloud tech such as REST API & JSON.
43+
44+
In SCIM, there are two parties: Clients and Service Providers.
45+
46+
A service provider (SP) is an application such as _Slack_ or _corporate app_ that requires to store identities and access. A client is the party that interacts with the SP in order to read and manage its identities automatically. a good example of a client is CrossID as it can interact with SCIM applications seamlessly.
47+
48+
## CrossID and SCIM
49+
50+
CrossID can intreact with any SCIM application with very minimal integration effort.
51+
52+
When changes are made in HR to employees, CrossID can sync those changes to SCIM apps according to corporate policies.
53+
54+
For example, if a sales manager joins the company it can create a user in CRM automatically and grant the relevant access according to the sales region.
55+
56+
When employee leaves the company it will automatically de-provision any users and access the employee has.
57+
58+
CrossID can also read all identities and privileges from SCIM apps and save those details in its own store.
59+
This is handful in order to consolidate identities, detect vulnerabilities and exccessive access and notify or take actions when such incidents occur.
60+
61+
It even takes SCIM further by exposing SCIM protocol to the outside world and act as an intermediate between other IDPs and corproate applications.
62+
63+
import useBaseUrl from '@docusaurus/useBaseUrl';
64+
65+
<img alt="CrossID-SCIM" src={useBaseUrl('img/blog/crossid-scim.png')} />
66+
67+
## Conclusions
68+
69+
SCIM make it easier, faster and cheaper to exchange identities across applications.
70+
71+
When used in conjunction with SSO standards such as Oauth2/OIDC or SAML, SCIM provides IT an end-to-end standard solution for identity and access management.

blog/2018-08-19-scim-schema-ext.md

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
slug: scim-schema-extensions
3+
title: SCIM Schema Extensions
4+
description: What are SCIM schema extensions and how to use them.
5+
author: Asaf Shakarzy
6+
author_title: Core Team
7+
author_url: https://github.com/asaf
8+
tags: ["SCIM", "provisioning", "cloud"]
9+
---
10+
11+
## Preface
12+
13+
SCIM Schema is a logical group of attributes,
14+
15+
Every resource type (such "User" or "Group") has a primary schema and possibly optional extensions.
16+
17+
The main schema defines how resources (e.g., "users") of some resource type (e.g., "User") look like,
18+
19+
<!-- truncate -->
20+
21+
For example the _urn:ietf:params:scim:schemas:core:2.0:User_ schema defines how a User should look like,
22+
23+
It is encouraged to use this core schema by every application that supports users,
24+
25+
But what happens when we need other attributes that are not covered by the primary schema? for instance, lets say we want to store the user's manager details,
26+
since the manager is another user within the system, we want to store a reference to it, manager doesn't exist in the core User schema, thus we need an extension
27+
that provides the definition of this attribute,
28+
29+
Luckily, SCIM comes with another schema named [enterprise](https://tools.ietf.org/html/rfc7643#section-4.3), which is an extension to the core user schema and can be used whenever organization attributes are needed,
30+
31+
## JSON representation of User with extension
32+
33+
SCIM distinguishes between the attributes of the primary schema and the extensions by placing the primary schema attributes in the root of the document while extension attributes are stored under the namespace of the extension.
34+
35+
Here is a JSON of a user with the enterprise extension:
36+
37+
```json
38+
{
39+
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"],
40+
"id": "2819c223-7f76-453a-919d-413861904646",
41+
"externalId": "701984",
42+
"userName": "[email protected]",
43+
"name": {
44+
"formatted": "Ms. Barbara J Jensen, III",
45+
"familyName": "Jensen",
46+
"givenName": "Barbara"
47+
}
48+
"displayName": "Babs Jensen",
49+
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
50+
"employeeNumber": "701984",
51+
"costCenter": "4130",
52+
"organization": "Universal Studios",
53+
"division": "Theme Park",
54+
"department": "Tour Operations",
55+
"manager": {
56+
"value": "26118915-6090-4610-87e4-49d8ca9f808d",
57+
"$ref": "../Users/26118915-6090-4610-87e4-49d8ca9f808d",
58+
"displayName": "John Smith"
59+
}
60+
},
61+
"meta": {
62+
"resourceType": "User",
63+
}
64+
}
65+
```
66+
67+
Lets explain the important attributes here:
68+
69+
_schemas_: Since this is a user record, it must have the _urn:ietf:params:scim:schemas:core:2.0:User_
70+
but this user also have some enterprise attributes (e.g., "costCenter", "manager") it also have the _urn:ietf:params:scim:schemas:extension:enterprise:2.0:User_ schema.
71+
72+
Primary attributes (such _id_, _externalId_, etc) are defined in the root level of the record.
73+
74+
Please note: The extension schemas are required to be mentioned only if the record has attributes of the extension,
75+
for example, some user records may not have the _enterprise_ schema if they don't don't store any of the enterprise attributes.
76+
77+
_urn:ietf:params:scim:schemas:extension:enterprise:2.0:User_: Every attribute of the _enterprise_ extension must be defined under the extension urn.
78+
79+
This way we can distinguish from attributes defined in the primary schema and attributes defined in the extensions.

blog/2021-02-06-nextjs-i18n.md

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
slug: nextjs-i18n
3+
title: nextjs I18n, zero deps
4+
author: Asaf Shakarzy
5+
author_title: Core Team
6+
author_url: https://github.com/asaf
7+
tags: [nextjs, react, jamstack]
8+
---
9+
10+
NextJS already ships with [built in support for i18n](https://nextjs.org/docs/advanced-features/i18n-routing).
11+
12+
But extra bits are required to perform the actual translation.
13+
14+
While it's possible to use dependencies such as `react-intl`, this post shows a much simpler and cleaner approach
15+
that scales right, no dependencies required!
16+
17+
<!--truncate-->
18+
19+
## Configuring I18N locales in next.config.js
20+
21+
First, lets add support for _english_ and _japanese_ locales, here is our `next.config.js`:
22+
23+
```json
24+
module.exports = {
25+
i18n: {
26+
locales: ["en", "ja"],
27+
defaultLocale: "en",
28+
},
29+
};
30+
```
31+
32+
next.js generates pages for default, _en_ and _ja_ URLs paths:
33+
34+
- default to english: _http://localhost:3000_
35+
- english locale: _http://localhost:3000/en_
36+
- japanese locale: http://localhost:3000/ja
37+
- any other locales which are not specified in _locales_ would cause 404 (e.g.,: http://localhost:3000/he)
38+
39+
## Where to store messages translations
40+
41+
We could store the messages in a single file in the form of _page_._key_
42+
43+
```js
44+
{
45+
en: {
46+
index.welcome: 'Welcome to'
47+
},
48+
ja: {
49+
index.welcome: 'ようこそ'
50+
}
51+
}
52+
```
53+
54+
The other alternative is to store messages on each component file.
55+
56+
I personally prefer the _per component_ approach as it scales right, no need to maintain prefixes to avoid collisions and every piece of code related to a component stays within the same file, same as where we store PropTypes.
57+
58+
To perform the actual translation, we have to:
59+
60+
1. `useRouter()` hook to determine the current locale.
61+
1. use that locale to find a message in locale's messages.
62+
1. do the translation, preferably support placeholders in messages.
63+
64+
## The i18n hook
65+
66+
Lets write a hook to make the actual translation even simpler:
67+
68+
```js
69+
import { useCallback } from "react";
70+
import { useRouter } from "next/router";
71+
72+
// format("hello {0}", "world") returns "hello world"
73+
const format = (msg, ...args) => {
74+
for (let k in args) {
75+
msg = msg.replace("{" + k + "}", args[k]);
76+
}
77+
return msg;
78+
};
79+
80+
// useI18n is a react hook that returns t func, which translates a message according to current locale.
81+
export function useI18n(msgs) {
82+
const router = useRouter();
83+
const { locale } = router;
84+
85+
const t = useCallback(
86+
(id, ...args) => {
87+
const lmsgs = msgs[locale];
88+
const msg = lmsgs[id] || msgs.en[id] || id;
89+
90+
return format(msg, ...args);
91+
},
92+
[locale]
93+
);
94+
95+
return {
96+
t,
97+
locale,
98+
};
99+
}
100+
101+
export default useI18n;
102+
```
103+
104+
Here's example how to use the hook:
105+
106+
```js
107+
export default function Home() {
108+
const { t } = useI18n(msgs);
109+
return (
110+
<main>
111+
<h1 className={styles.title}>{t("welcome_to", "next.js")}</h1>
112+
</main>
113+
);
114+
}
115+
116+
const msgs = {
117+
en: {
118+
welcome_to: "Welcome to {0}",
119+
},
120+
ja: {
121+
welcome_to: "ようこそ {0}",
122+
},
123+
};
124+
```
125+
126+
1. We pass msgs into the _useI18n_ hook.
127+
1. The hook determine the current locale using `useRouter()`
128+
1. The hook uses the corresponding locale key within the msgs object.
129+
1. The hook translate the message with support for placeholders.
130+
131+
Try to hit `http://localhost:3000/en` or `http://localhost:3000/je` to see the translation in english and japanese, respectively.
132+
133+
Code sample available in [https://github.com/asaf/nextjs-i18n-example](https://github.com/asaf/nextjs-i18n-example)

docs/concepts/application.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
id: application
3+
title: Application
4+
sidebar_label: Application
5+
slug: /concepts/application
6+
description: What is an Application
7+
---
8+
9+
An _app_ represents your application where users logs in.
10+
11+
An app is typically a web server but today SPA and native apps are also common.
12+
13+
### App Types
14+
15+
| App Type | Client Type | Description |
16+
| ----------------------------- | ----------- | --------------------------------------------------------------------------- |
17+
| Native | public | Mobile, Desktop, Smart device and CLI (e.g., _Android_, _Apple TV_, _iOS_.) |
18+
| Single Page Application (SPA) | public | Javascript front-end app with no server (e.g., _React.js_ or _Vue_) |
19+
| Server-side | private | Typically a web server (e.g., _Node.js_, _Golang_, _PHP_) |
20+
| Machine to Machine | private | Server side worker such as daemon or a micro service. |
21+
22+
<!--| | Device | public | A device such as Smart TV or IoT device. | || -->

0 commit comments

Comments
 (0)