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