mirror of
https://github.com/portainer/portainer.git
synced 2025-08-03 04:45:21 +02:00
feat(setting/oauth): add authstyle option [EE-6038] (#11610)
This commit is contained in:
parent
6623475035
commit
ffc66647f8
12 changed files with 135 additions and 18 deletions
|
@ -0,0 +1,50 @@
|
|||
import { Options } from '@/react/edge/components/useIntervalOptions';
|
||||
import { OAuthStyle } from '@/react/portainer/settings/types';
|
||||
|
||||
import { FormControl, Size } from '@@/form-components/FormControl';
|
||||
import { Select } from '@@/form-components/Input';
|
||||
|
||||
interface Props {
|
||||
value: OAuthStyle;
|
||||
onChange(value: OAuthStyle): void;
|
||||
label?: string;
|
||||
tooltip?: string;
|
||||
readonly?: boolean;
|
||||
size?: Size;
|
||||
}
|
||||
|
||||
// The options are based on oauth2 lib definition @https://pkg.go.dev/golang.org/x/oauth2#AuthStyle
|
||||
export const authStyleOptions: Options = [
|
||||
{ label: 'Auto Detect', value: OAuthStyle.AutoDetect, isDefault: true },
|
||||
{ label: 'In Params', value: OAuthStyle.InParams },
|
||||
{ label: 'In Header', value: OAuthStyle.InHeader },
|
||||
];
|
||||
|
||||
export function AuthStyleField({
|
||||
value,
|
||||
readonly = false,
|
||||
onChange,
|
||||
label = 'Auth Style',
|
||||
tooltip = 'Auth Style specifies how the endpoint wants the client ID & client secret sent.',
|
||||
size = 'small',
|
||||
}: Props) {
|
||||
return (
|
||||
<FormControl
|
||||
inputId="oauth_authstyle"
|
||||
label={label}
|
||||
tooltip={tooltip}
|
||||
size={size}
|
||||
>
|
||||
<Select
|
||||
value={value}
|
||||
onChange={(e) => {
|
||||
onChange(parseInt(e.currentTarget.value, 10));
|
||||
}}
|
||||
options={authStyleOptions}
|
||||
disabled={readonly}
|
||||
id="oauth_authstyle"
|
||||
data-cy="setting-oauth-authstyle-select"
|
||||
/>
|
||||
</FormControl>
|
||||
);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export { AuthStyleField } from './AuthStyleField';
|
|
@ -87,6 +87,15 @@ export enum AuthenticationMethod {
|
|||
OAuth,
|
||||
}
|
||||
|
||||
/**
|
||||
* The definition are based on oauth2 lib definition @https://pkg.go.dev/golang.org/x/oauth2#AuthStyle
|
||||
*/
|
||||
export enum OAuthStyle {
|
||||
AutoDetect = 0,
|
||||
InParams,
|
||||
InHeader,
|
||||
}
|
||||
|
||||
type Feature = string;
|
||||
|
||||
export interface DefaultRegistry {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue