mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-19 15:31:59 +00:00
Merge pull request #19 from open-metadata/add_callback_config
Authentication: Add callback URL
This commit is contained in:
commit
62d5d88502
@ -20,7 +20,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.openmetadata.catalog.CatalogApplicationConfig;
|
||||
import org.openmetadata.catalog.security.AuthenticationConfiguration;
|
||||
import org.openmetadata.catalog.security.AuthorizerConfiguration;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
@ -45,6 +44,10 @@ public class ConfigResource {
|
||||
@Path(("/auth"))
|
||||
@Operation(summary = "Get auth configuration")
|
||||
public AuthenticationConfiguration getAuthConfig(@Context UriInfo uriInfo, @Context SecurityContext securityContext) {
|
||||
return catalogApplicationConfig.getAuthenticationConfiguration();
|
||||
AuthenticationConfiguration authenticationConfiguration = new AuthenticationConfiguration();
|
||||
if (catalogApplicationConfig.getAuthenticationConfiguration() != null) {
|
||||
authenticationConfiguration = catalogApplicationConfig.getAuthenticationConfiguration();
|
||||
}
|
||||
return authenticationConfiguration;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ public class AuthenticationConfiguration {
|
||||
|
||||
private String clientId;
|
||||
|
||||
private String callbackUrl;
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
@ -38,4 +40,12 @@ public class AuthenticationConfiguration {
|
||||
public void setClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getCallbackUrl() {
|
||||
return callbackUrl;
|
||||
}
|
||||
|
||||
public void setCallbackUrl(String callbackUrl) {
|
||||
this.callbackUrl = callbackUrl;
|
||||
}
|
||||
}
|
||||
|
@ -156,8 +156,12 @@ const AuthProvider: FunctionComponent<AuthProviderProps> = ({
|
||||
fetchAuthorizerConfig()
|
||||
.then((res: AxiosResponse) => {
|
||||
if (res.data) {
|
||||
const { provider, authority, clientId } = res.data;
|
||||
const userConfig = getUserManagerConfig({ authority, clientId });
|
||||
const { provider, authority, clientId, callbackUrl } = res.data;
|
||||
const userConfig = getUserManagerConfig({
|
||||
authority,
|
||||
clientId,
|
||||
callbackUrl,
|
||||
});
|
||||
setUserManagerConfig(userConfig);
|
||||
setUserManager(makeUserManager(userConfig));
|
||||
if (!oidcUserToken) {
|
||||
|
@ -211,6 +211,7 @@ declare module 'Models' {
|
||||
authority: string;
|
||||
client_id: string;
|
||||
provider?: 'google' | 'okta' | 'github';
|
||||
callbackUrl?: string;
|
||||
signingIn?: boolean;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { CookieStorage } from 'cookie-storage';
|
||||
import { isNil } from 'lodash';
|
||||
import { WebStorageStateStore } from 'oidc-client';
|
||||
import { isDev } from '../utils/EnvironmentUtils';
|
||||
|
||||
@ -11,7 +12,7 @@ export const getOidcExpiry = () => {
|
||||
export const getUserManagerConfig = (
|
||||
authClient: Record<string, string> = {}
|
||||
): Record<string, string | WebStorageStateStore> => {
|
||||
const { authority, clientId } = authClient;
|
||||
const { authority, clientId, callbackUrl } = authClient;
|
||||
|
||||
return {
|
||||
authority,
|
||||
@ -22,7 +23,9 @@ export const getUserManagerConfig = (
|
||||
// eslint-disable-next-line @typescript-eslint/camelcase
|
||||
redirect_uri: isDev()
|
||||
? 'http://localhost:3000/callback'
|
||||
: 'http://localhost:8585/callback',
|
||||
: !isNil(callbackUrl)
|
||||
? callbackUrl
|
||||
: `${window.location.origin}/callback`,
|
||||
scope: 'openid email profile',
|
||||
userStore: new WebStorageStateStore({ store: cookieStorage }),
|
||||
};
|
||||
|
@ -137,3 +137,4 @@ authenticationConfiguration:
|
||||
publicKey: "https://www.googleapis.com/oauth2/v3/certs"
|
||||
authority: "https://accounts.google.com"
|
||||
clientId: "261867039324-neb92r2147i6upchb78tv29idk079bps.apps.googleusercontent.com"
|
||||
callbackUrl: "http://localhost:8585/callback"
|
||||
|
@ -132,6 +132,7 @@ authenticationConfiguration:
|
||||
publicKey: "https://www.googleapis.com/oauth2/v3/certs"
|
||||
authority: "https://accounts.google.com"
|
||||
clientId: "261867039324-neb92r2147i6upchb78tv29idk079bps.apps.googleusercontent.com"
|
||||
callbackUrl: "http://localhost:8585/callback"
|
||||
|
||||
elasticsearch:
|
||||
host: localhost
|
||||
|
@ -99,7 +99,7 @@ class ElasticSearchBulkSink(BulkSink):
|
||||
suggest = [{'input': [fqdn], 'weight': 5}, {'input': [table_name], 'weight': 10}]
|
||||
column_names = []
|
||||
column_descriptions = []
|
||||
tags = set[str]()
|
||||
tags = set()
|
||||
|
||||
timestamp = time.time()
|
||||
tier = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user