Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Credential Manager support #1031

Merged
merged 6 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions examples/directory/clients/My Native app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "My Native app",
"app_type": "native",
"grant_types": [
"authorization_code",
"implicit",
"refresh_token"
],
"mobile": {
"android": {
"app_package_name": "com.my.android.id"
}
},
"native_social_login": {
"google": {
"enabled": true
},
"facebook": {
"enabled": false
},
"apple": {
"enabled": false
}
},
"is_first_party": true,
"sso_disabled": false,
"cross_origin_auth": false,
"oidc_conformant": false,
"oidc_backchannel_logout": {
"backchannel_logout_initiators": {
"mode": "custom",
"selected_initiators": [
"rp-logout",
"idp-logout"
]
}
},
"jwt_configuration": {
"lifetime_in_seconds": 36000,
"secret_encoded": false
},
"token_endpoint_auth_method": "none",
"custom_login_page_on": true,
"oidc_logout": {
"backchannel_logout_initiators": {
"mode": "custom",
"selected_initiators": [
"rp-logout",
"idp-logout"
]
}
}
}
11 changes: 10 additions & 1 deletion examples/yaml/tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ clients:
name: "My M2M"
app_type: "non_interactive"
# Add other client settings https://auth0.com/docs/api/management/v2#!/Clients/post_clients

-
name: "My Native app"
app_type: native
mobile:
android:
app_package_name: com.my.android.id
native_social_login:
google:
enabled: true
# Add other client settings https://auth0.com/docs/api/management/v2#!/Clients/post_clients

databases:
- name: "users"
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"homepage": "https://github.com/auth0/auth0-deploy-cli#readme",
"dependencies": {
"ajv": "^6.12.6",
"auth0": "^4.17.0",
"auth0": "^4.18.0",
"dot-prop": "^5.2.0",
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0",
Expand Down
45 changes: 45 additions & 0 deletions src/tools/auth0/handlers/clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,51 @@ export const schema = {
type: 'object',
properties: {
name: { type: 'string', minLength: 1, pattern: '[^<>]+' },
mobile: {
type: 'object',
properties: {
android: {
type: 'object',
properties: {
app_package_name: { type: 'string' },
sha256_cert_fingerprints: {
type: 'array',
items: { type: 'string' },
},
},
},
ios: {
type: 'object',
properties: {
team_id: { type: 'string' },
app_bundle_identifier: { type: 'string' },
},
},
},
},
native_social_login: {
type: 'object',
properties: {
apple: {
type: 'object',
properties: {
enabled: { type: 'boolean' },
},
},
facebook: {
type: 'object',
properties: {
enabled: { type: 'boolean' },
},
},
google: {
type: 'object',
properties: {
enabled: { type: 'boolean' },
},
},
},
},
},
required: ['name'],
},
Expand Down
54 changes: 54 additions & 0 deletions test/tools/auth0/handlers/clients.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ const pool = {
},
};

const someNativeClient = {
name: 'someNativeClient',
app_type: 'native',
grant_types: ['authorization_code', 'implicit', 'refresh_token'],
mobile: {
android: {
app_package_name: 'com.my.android.id',
},
},
native_social_login: {
google: {
enabled: true,
},
},
};

describe('#clients handler', () => {
const config = function (key) {
return config.data && config.data[key];
Expand Down Expand Up @@ -80,6 +96,44 @@ describe('#clients handler', () => {
await stageFn.apply(handler, [{ clients: [{ name: 'someClient' }] }]);
});

it('should create native client', async () => {
const auth0 = {
clients: {
create: function (data) {
(() => expect(this).to.not.be.undefined)();
expect(data).to.be.an('object');
expect(data.name).to.equal('someNativeClient');
expect(data.app_type).to.equal('native');
expect(data.grant_types).to.deep.equal([
'authorization_code',
'implicit',
'refresh_token',
]);
expect(data.mobile).to.deep.equal({
android: {
app_package_name: 'com.my.android.id',
},
});
expect(data.native_social_login).to.deep.equal({
google: {
enabled: true,
},
});
return Promise.resolve({ data });
},
update: () => Promise.resolve({ data: [] }),
delete: () => Promise.resolve({ data: [] }),
getAll: (params) => mockPagedData(params, 'clients', []),
},
pool,
};

const handler = new clients.default({ client: pageClient(auth0), config });
const stageFn = Object.getPrototypeOf(handler).processChanges;

await stageFn.apply(handler, [{ clients: [someNativeClient] }]);
});

it('should get clients', async () => {
const auth0 = {
clients: {
Expand Down