Skip to content

Commit

Permalink
SHIBUI-704 Implemented schema definition
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Nov 7, 2018
1 parent d80f0db commit 20efb34
Show file tree
Hide file tree
Showing 4 changed files with 823 additions and 0 deletions.
19 changes: 19 additions & 0 deletions backend/src/main/resources/i18n/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ value.entity-attributes-filter=EntityAttributes Filter
value.spdescriptor=SPSSODescriptor
value.attr-auth-descriptor=AttributeAuthorityDescriptor

value.dynamic-http-metadata-provider=DynamicHttpMetadataProvider

brand.header.title=Source Management
brand.logo-link-label=Shibboleth
brand.logo-link-description=Link to Shibboleth Website
Expand Down Expand Up @@ -332,6 +334,15 @@ label.attribute-eduPersonUniqueId=eduPersonUniqueId
label.attribute-employeeNumber=employeeNumber
label.force-authn=Force AuthN

label.dynamic-attributes=Dynamic Attributes
label.min-cache-duration=Min Cache Duration
label.max-cache-duration=Max Cache Duration
label.max-idle-entity-data=Max Idle Entity Data
label.cleanup-task-interval=Cleanup Task Interval
label.persistent-cache-manager-directory=Persistent Cache Manager Directory
label.initialize-from-persistent-cache-in-background=Initialize from Persistent Cache in Background?
label.background-init-from-cache-delay=Background Initialization from Cache Delay

message.must-be-unique=Must be unique.
message.name-must-be-unique=Name must be unique.
message.uri-valid-format=URI must be valid format.
Expand Down Expand Up @@ -453,3 +464,11 @@ tooltip.expiration-warning-threshold=For each attempted metadata refresh (whethe
tooltip.filter-name=Filter Name
tooltip.enable-filter=Enable Filter?
tooltip.enable-service=Enable Service?

tooltip.min-cache-duration=The minimum duration for which metadata will be cached before it is refreshed.
tooltip.max-cache-duration=The maximum duration for which metadata will be cached before it is refreshed.
tooltip.max-idle-entity-data=The maximum duration for which metadata will be allowed to be idle (no requests for it) before it is removed from the cache.
tooltip.cleanup-task-interval=The interval at which the internal cleanup task should run. This task performs background maintenance tasks, such as the removal of expired and idle metadata.
tooltip.persistent-cache-manager-directory=The optional manager for the persistent cache store for resolved metadata. On metadata provider initialization, data present in the persistent cache will be loaded to memory, effectively restoring the state of the provider as closely as possible to that which existed before the previous shutdown. Each individual cache entry will only be loaded if 1) the entry is still valid as determined by the internal provider logic, and 2) the entry passes the (optional) predicate supplied via initializationFromCachePredicateRef.
tooltip.initialize-from-persistent-cache-in-background=Flag indicating whether should initialize from the persistent cache in the background. Initializing from the cache in the background will improve IdP startup times.
tooltip.background-init-from-cache-delay=The delay after which to schedule the background initialization from the persistent cache when initializeFromPersistentCacheInBackground=true.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { BaseMetadataProvider } from './base-metadata-provider';

export interface DynamicHttpMetadataProvider extends BaseMetadataProvider {
id: string;
metadataURL: string;
dynamicMetadataResolverAttributes: DynamicMetadataResolverAttributes;
httpMetadataResolverAttributes: HttpMetadataResolverAttributes;
maxConnectionsTotal: number;
maxConnectionsPerRoute: number;
supportedContentTypes: string[];
}

export interface DynamicMetadataResolverAttributes {
refreshDelayFactor: number;
minCacheDuration: string;
maxCacheDuration: string;
maxIdleEntityData: string;
removeIdleEntityData: boolean;
cleanupTaskInterval: string;

persistentCacheManagerRef: string;
persistentCacheManagerDirectory: string;
persistentCacheKeyGeneratorRef: string;
initializeFromPersistentCacheInBackground: boolean;
backgroundInitializationFromCacheDelay: string;
initializationFromCachePredicateRef: string;
}

export interface HttpMetadataResolverAttributes {
httpClientRef;
connectionRequestTimeout: string;
connectionTimeout: string;
socketTimeout: string;
disregardTLSCertificate: boolean;
tlsTrustEngineRef: string;
httpClientSecurityParametersRef: string;
proxyHost: string;
proxyPort: string;
proxyUser: string;
proxyPassword: string;
httpCaching: HttpCachingType;
httpCacheDirectory: string;
httpMaxCacheEntries: number;
httpMaxCacheEntrySize: number;
}

export enum HttpCachingType {
NONE = 'none',
FILE = 'file',
MEMORY = 'memory'
}
133 changes: 133 additions & 0 deletions ui/src/app/metadata/provider/model/dynamic-http.provider.form.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import { Wizard } from '../../../wizard/model';
import { DynamicHttpMetadataProvider } from '../../domain/model/providers/dynamic-http-metadata-provider';
import { BaseMetadataProviderEditor } from './base.provider.form';
import UriValidator from '../../../shared/validation/uri.validator';

export const DynamicHttpMetadataProviderWizard: Wizard<DynamicHttpMetadataProvider> = {
...BaseMetadataProviderEditor,
label: 'DynamicHttpMetadataProvider',
type: 'DynamicHttpMetadataResolver',
getValidators(namesList: string[] = [], xmlIdList: string[] = []): any {
const validators = BaseMetadataProviderEditor.getValidators(namesList);
validators['/xmlId'] = (value, property, form) => {
const err = xmlIdList.indexOf(value) > -1 ? {
code: 'INVALID_ID',
path: `#${property.path}`,
message: 'message.id-unique',
params: [value]
} : null;
return err;
};
validators['/metadataURL'] = (value, property, form) => {
return !UriValidator.isUri(value) ? {
code: 'INVALID_URI',
path: `#${property.path}`,
message: 'message.uri-valid-format',
params: [value]
} : null;
};

return validators;
},
steps: [
{
id: 'common',
label: 'label.common-attributes',
index: 2,
initialValues: [],
schema: 'assets/schema/provider/dynamic-http.schema.json',
fields: [
'xmlId',
'metadataURL',
'requireValidMetadata',
'failFastInitialization'
]
},
{
id: 'dynamic',
label: 'label.dynamic-attributes',
index: 3,
initialValues: [],
schema: 'assets/schema/provider/dynamic-http.schema.json',
fields: [
'dynamicMetadataResolverAttributes'
]
},
{
id: 'plugins',
label: 'label.metadata-filter-plugins',
index: 4,
initialValues: [
{ key: 'metadataFilters', value: [] }
],
schema: 'assets/schema/provider/dynamic-http.schema.json',
fields: [
'metadataFilters'
]
},
{
id: 'summary',
label: 'label.finished',
index: 5,
initialValues: [],
schema: 'assets/schema/provider/dynamic-http.schema.json',
fields: [
'enabled'
]
}
]
};


export const DynamicHttpMetadataProviderEditor: Wizard<DynamicHttpMetadataProvider> = {
...DynamicHttpMetadataProviderWizard,
steps: [
{
id: 'common',
label: 'label.common-attributes',
index: 1,
initialValues: [],
schema: 'assets/schema/provider/dynamic-http.schema.json',
fields: [
'enabled',
'xmlId',
'metadataURL',
'requireValidMetadata',
'failFastInitialization'
]
},
{
id: 'dynamic',
label: 'label.dynamic-attributes',
index: 3,
initialValues: [],
schema: 'assets/schema/provider/dynamic-http.schema.json',
fields: [
'dynamicMetadataResolverAttributes'
]
},
{
id: 'plugins',
label: 'label.metadata-filter-plugins',
index: 4,
initialValues: [
{ key: 'metadataFilters', value: [] }
],
schema: 'assets/schema/provider/dynamic-http.schema.json',
fields: [
'metadataFilters'
]
},
{
id: 'advanced',
label: 'label.advanced-settings',
index: 4,
initialValues: [],
locked: true,
schema: 'assets/schema/provider/filebacked-http-advanced.schema.json',
fields: [
'httpMetadataResolverAttributes'
]
}
]
};
Loading

0 comments on commit 20efb34

Please sign in to comment.