Skip to content

Commit f8d3edc

Browse files
authored
Merge pull request #20213 from mozilla/FXA-13225
feat(auth): Add client_id and service tags to StatsD, Sentry, and security events
2 parents eb76533 + 71215a5 commit f8d3edc

55 files changed

Lines changed: 709 additions & 145 deletions

Some content is hidden

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

libs/accounts/oauth/.eslintrc.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": ["../../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
}
17+
]
18+
}

libs/accounts/oauth/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# oauth
2+
3+
This library was generated with [Nx](https://nx.dev).
4+
5+
## Building
6+
7+
Run `nx build oauth` to build the library.
8+
9+
## Running unit tests
10+
11+
Run `nx test oauth` to execute the unit tests via [Jest](https://jestjs.io).

libs/accounts/oauth/jest.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
displayName: 'oauth',
3+
preset: '../../../jest.preset.js',
4+
testEnvironment: 'node',
5+
transform: {
6+
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
7+
},
8+
moduleFileExtensions: ['ts', 'js', 'html'],
9+
coverageDirectory: '../../../coverage/libs/accounts/oauth',
10+
};

libs/accounts/oauth/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@fxa/accounts/oauth",
3+
"version": "0.0.1",
4+
"private": true,
5+
"type": "commonjs",
6+
"main": "./index.cjs",
7+
"types": "./index.d.ts",
8+
"dependencies": {}
9+
}

libs/accounts/oauth/project.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "oauth",
3+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "libs/accounts/oauth/src",
5+
"projectType": "library",
6+
"tags": [],
7+
"targets": {
8+
"build": {
9+
"executor": "@nx/esbuild:esbuild",
10+
"outputs": ["{options.outputPath}"],
11+
"options": {
12+
"outputPath": "dist/libs/accounts/oauth",
13+
"main": "libs/accounts/oauth/src/index.ts",
14+
"tsConfig": "libs/accounts/oauth/tsconfig.lib.json",
15+
"assets": ["libs/accounts/oauth/*.md"],
16+
"format": ["cjs"],
17+
"generatePackageJson": true
18+
}
19+
},
20+
"test": {
21+
"executor": "@nx/jest:jest",
22+
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
23+
"options": {
24+
"jestConfig": "libs/accounts/oauth/jest.config.ts"
25+
}
26+
}
27+
}
28+
}

libs/accounts/oauth/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './lib/oauth';
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
import { OAuthNativeClients, OAuthNativeServices } from './oauth';
6+
7+
describe('OAuthNativeClients', () => {
8+
it('has expected client IDs', () => {
9+
expect(OAuthNativeClients.FirefoxDesktop).toEqual('5882386c6d801776');
10+
expect(OAuthNativeClients.FirefoxIOS).toEqual('1b1a3e44c54fbb58');
11+
expect(OAuthNativeClients.Fenix).toEqual('a2270f727f45f648');
12+
});
13+
});
14+
15+
describe('OAuthNativeServices', () => {
16+
it('has expected service names', () => {
17+
expect(OAuthNativeServices.Sync).toEqual('sync');
18+
expect(OAuthNativeServices.Relay).toEqual('relay');
19+
expect(OAuthNativeServices.Vpn).toEqual('vpn');
20+
expect(OAuthNativeServices.SmartWindow).toEqual('smartwindow');
21+
});
22+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
export enum OAuthNativeClients {
6+
FirefoxIOS = '1b1a3e44c54fbb58',
7+
FirefoxDesktop = '5882386c6d801776',
8+
Fenix = 'a2270f727f45f648',
9+
Fennec = '3332a18d142636cb',
10+
// For Android testing
11+
ReferenceBrowser = '3c49430b43dfba77',
12+
// TODO: handle Thunderbird case better, FXA-10848
13+
Thunderbird = '8269bacd7bbc7f80',
14+
}
15+
16+
/**
17+
* These come through via data.service (a query parameter).
18+
*/
19+
export enum OAuthNativeServices {
20+
Sync = 'sync',
21+
Relay = 'relay',
22+
SmartWindow = 'smartwindow',
23+
Vpn = 'vpn',
24+
}

libs/accounts/oauth/tsconfig.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"extends": "../../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"module": "commonjs",
5+
"forceConsistentCasingInFileNames": true,
6+
"strict": true,
7+
"importHelpers": true,
8+
"noImplicitOverride": true,
9+
"noImplicitReturns": true,
10+
"noFallthroughCasesInSwitch": true,
11+
"noPropertyAccessFromIndexSignature": true
12+
},
13+
"files": [],
14+
"include": [],
15+
"references": [
16+
{
17+
"path": "./tsconfig.lib.json"
18+
},
19+
{
20+
"path": "./tsconfig.spec.json"
21+
}
22+
]
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "../../../dist/out-tsc",
5+
"declaration": true,
6+
"types": ["node"]
7+
},
8+
"include": ["src/**/*.ts"],
9+
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"]
10+
}

0 commit comments

Comments
 (0)