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

Introduce JWT Access Token Attributes #6730

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,4 @@ identity-apps-core/apps/*/src/main/webapp/includes/layouts
.repository/
apps/console/src/extensions/i18n/tmp/**
.nx
.pnpm-store/
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com).
shashimalcse marked this conversation as resolved.
Show resolved Hide resolved
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import Checkbox from "@oxygen-ui/react/Checkbox";
import Grid from "@oxygen-ui/react/Grid";
import ListItemText from "@oxygen-ui/react/ListItemText";
import { IdentifiableComponentInterface } from "@wso2is/core/models";
import React, {
FunctionComponent,
HTMLAttributes,
ReactElement
} from "react";

interface AutoCompleteRenderOption extends IdentifiableComponentInterface {
/**
* Is the option selected.
*/
selected?: boolean;
/**
* The display name of the option.
*/
displayName: string;
/**
* The props passed to the option.
*/
renderOptionProps: HTMLAttributes<HTMLLIElement>
}

export const AutoCompleteRenderOption: FunctionComponent<AutoCompleteRenderOption> = (
props: AutoCompleteRenderOption
): ReactElement => {

const {
selected,
displayName,
renderOptionProps
} = props;

return (
<li { ...renderOptionProps }>
<Grid container justifyContent="space-between" alignItems="center" xs={ 12 }>
<Grid container alignItems="center" xs={ 8 }>
<Grid>
{
typeof selected === "boolean" && (
<Checkbox checked={ selected } />
)
}
</Grid>
<Grid xs={ 5 }>
<ListItemText primary={ displayName }/>

Check warning on line 66 in features/admin.applications.v1/components/auto-complete-render-option.tsx

View workflow job for this annotation

GitHub Actions / ⬣ ESLint (STATIC ANALYSIS) (lts/*, 8.7.4)

Trailing spaces not allowed
</Grid>
</Grid>
</Grid>
</li>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,14 @@
margin-top: 0 !important;
margin-right: 1rem !important;
}

.jwt-attributes-dropdown-input {
input {
border: none !important;
width: auto !important;
}
}
.jwt-attributes-dropdown-label-column {
margin-bottom: 0.3rem !important;
font-size: 0.9rem !important;
}
178 changes: 171 additions & 7 deletions features/admin.applications.v1/components/forms/inbound-oidc-form.tsx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
store
} from "@wso2is/admin.core.v1";
import { applicationConfig } from "@wso2is/admin.extensions.v1";
import { hasRequiredScopes } from "@wso2is/core/helpers";

Check failure on line 27 in features/admin.applications.v1/components/settings/access-configuration.tsx

View workflow job for this annotation

GitHub Actions / ⬣ ESLint (STATIC ANALYSIS) (lts/*, 8.7.4)

'hasRequiredScopes' import from '@wso2is/core/helpers' is restricted. Please use "import { useRequiredScopes } from '@wso2is/access-control'" instead. Refer documentation: https://github.com/wso2/identity-apps/blob/master/docs/write-code/PERFORMANCE.md#use-userequiredscopes-hook-instead-of-hasrequiredscopes-function
import { AlertLevels, IdentifiableComponentInterface, SBACInterface } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
import { FormValue } from "@wso2is/forms";
Expand Down Expand Up @@ -216,6 +216,7 @@
isLoading,
setIsLoading,
onUpdate,
onProtocolUpdate,
allowedOriginList,
onAllowedOriginsUpdate,
onApplicationSecretRegenerate,
Expand Down Expand Up @@ -377,7 +378,7 @@
".genericError.message")
}));
}).finally(() => {
onUpdate(appId);
onProtocolUpdate();
if (!updateError) {
createSAMLApplication();
}
Expand Down
5 changes: 5 additions & 0 deletions features/admin.applications.v1/models/application-inbound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ interface AccessTokenConfigurationInterface {
bindingType?: SupportedAccessTokenBindingTypes | string;
revokeTokensWhenIDPSessionTerminated?: boolean;
validateTokenBinding?: boolean;
jwtAccessTokenAttributesConfiguration?: JWTAccessTokenConfigurationInterface;
}

shashimalcse marked this conversation as resolved.
Show resolved Hide resolved
interface JWTAccessTokenConfigurationInterface {
enable?: boolean;
attributes?: string[];
}
interface RefreshTokenConfigurationInterface {
expiryInSeconds?: number;
renewRefreshToken?: boolean;
Expand Down
9 changes: 9 additions & 0 deletions modules/i18n/src/models/namespaces/applications-ns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,15 @@ export interface ApplicationsNS {
invalid: string;
};
};
jwtAccessTokenAttributes: {
hint: string;
label:string;
description: string;
placeholder: string;
enable: {
label: string;
};
};
};
};
idToken: {
Expand Down
9 changes: 9 additions & 0 deletions modules/i18n/src/translations/en-US/portals/applications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,15 @@ export const applications: ApplicationsNS = {
empty: "Please fill the audience",
invalid: "Please avoid special characters like commas (,)"
}
},
jwtAccessTokenAttributes: {
hint : "",
shashimalcse marked this conversation as resolved.
Show resolved Hide resolved
label: "JWT Access Token Attributes",
description: "Define the attributes that should be included in the JWT access token.",
placeholder: "Search by attribute name",
enable: {
label: "Enable JWT Access Token Attributes Feature"
}
}
},
heading: "Access Token",
Expand Down
Loading