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

Feature/datasafe 238 update to angular17 #260

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,32 @@ public static class SecretKeyCreationCfg {
public static class EncryptingKeyCreationCfg {

@Builder.Default
private final String algo = "RSA";
private final String algo = "ECDH";

@Builder.Default
private final int size = 2048;
private final int size = 256;

@Builder.Default
private final String sigAlgo = "SHA256withECDSA";

@Builder.Default
private final String sigAlgo = "SHA256withRSA";
private final String customNamedCurve = "Curve25519";
}

@Getter
@Builder
public static class SigningKeyCreationCfg {

@Builder.Default
private final String algo = "RSA";
private final String algo = "ECDH";

@Builder.Default
private final int size = 256;

@Builder.Default
private final int size = 2048;
private final String sigAlgo = "SHA256withECDSA";

@Builder.Default
private final String sigAlgo = "SHA256withRSA";
private final String customNamedCurve = "Curve25519";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import de.adorsys.keymanagement.api.types.template.generated.Secret;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.crypto.ec.CustomNamedCurves;
import org.bouncycastle.jcajce.provider.asymmetric.util.EC5Util;

import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
Expand Down Expand Up @@ -89,6 +91,7 @@ public KeyStore createKeyStore(KeyStoreAuth keyStoreAuth,
.keySize(encConf.getSize())
.prefix("ENC")
.password(passSupplier)
.paramSpec(EC5Util.convertToSpec(CustomNamedCurves.getByName(encConf.getCustomNamedCurve())))
.build()
.repeat(keyConfig.getEncKeyNumber())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.servlet.handler.HandlerMappingIntrospector;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static de.adorsys.datasafe.rest.impl.security.SecurityConstants.TOKEN_HEADER;
import static org.springframework.security.config.Customizer.withDefaults;

@Configuration
@EnableWebSecurity
Expand All @@ -44,7 +47,7 @@ public class SecurityConfig {

@Bean
public SecurityFilterChain filterChain(HttpSecurity http, MvcRequestMatcher.Builder mvc, AuthenticationManager authenticationManager) throws Exception {
MvcRequestMatcher[] SWAGGER_RESOURCES = {
MvcRequestMatcher[] swaggerResources = {
mvc.pattern("/v2/api-docs"),
mvc.pattern("/configuration/ui"),
mvc.pattern("/swagger-resources"),
Expand All @@ -54,11 +57,10 @@ public SecurityFilterChain filterChain(HttpSecurity http, MvcRequestMatcher.Buil
mvc.pattern("/swagger-resources/configuration/ui"),
mvc.pattern("/swagger-ui.html")
};

http.cors(AbstractHttpConfigurer::disable)
http.cors(withDefaults())
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(authz -> authz
.requestMatchers(SWAGGER_RESOURCES).permitAll()
.requestMatchers(swaggerResources).permitAll()
.requestMatchers(mvc.pattern("/static/**")).permitAll()
.requestMatchers(mvc.pattern(SecurityConstants.AUTH_LOGIN_URL)).permitAll()
.requestMatchers(mvc.pattern(HttpMethod.OPTIONS, "/**")).permitAll()
Expand All @@ -77,8 +79,8 @@ MvcRequestMatcher.Builder mvc(HandlerMappingIntrospector introspector) {
}

@Bean
public InMemoryUserDetailsManager userDetailsService(PasswordEncoder passwordEncoder) {
UserDetails user = User.withDefaultPasswordEncoder()
public InMemoryUserDetailsManager userDetailsService(PasswordEncoder encoder) {
UserDetails user = User.builder().passwordEncoder(encoder::encode)
.username(securityProperties.getDefaultUser())
.password(securityProperties.getDefaultPassword())
.authorities("ROLE_USER")
Expand All @@ -101,19 +103,15 @@ public PasswordEncoder passwordEncoder() {
}

@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(List.of("http://localhost:4200"));
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));
configuration.setAllowedHeaders(List.of("*"));
configuration.setAllowCredentials(true);
configuration.addExposedHeader(TOKEN_HEADER);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();

CorsConfiguration authConfig = new CorsConfiguration().applyPermitDefaultValues();
authConfig.addExposedHeader(TOKEN_HEADER);
source.registerCorsConfiguration(SecurityConstants.AUTH_LOGIN_URL, authConfig);

CorsConfiguration globalConfig = new CorsConfiguration().applyPermitDefaultValues();
globalConfig.addAllowedMethod(HttpMethod.OPTIONS);
globalConfig.addAllowedMethod(HttpMethod.PUT);
globalConfig.addAllowedMethod(HttpMethod.DELETE);
source.registerCorsConfiguration("/**", globalConfig);

source.registerCorsConfiguration("/**", configuration);
return source;
}

Expand Down
8 changes: 8 additions & 0 deletions datasafe-rest-impl/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ datasafe.encryption.keystore.pbkdf.scrypt.parallelization=1
datasafe.encryption.keystore.pbkdf.scrypt.saltLength=16
datasafe.encryption.keystore.macAlgo=HmacSHA3_512
datasafe.encryption.cms.algo=AES256_GCM

#datasafe.encryption.keys.encrypting.algo=RSA
#datasafe.encryption.keys.encrypting.size=4096
#datasafe.encryption.keys.encrypting.sigAlgo=SHA256withRSA

#datasafe.encryption.keys.signing.algo=RSA
#datasafe.encryption.keys.signing.size=4096
#datasafe.encryption.keys.signing.sigAlgo=SHA256withRSA
2 changes: 2 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Use `npm run-script ng:serve:web` for local development
Use `npm run-script start` for electron development

Use `ng serve -c dev` if you need to debug

### Notes
- API url and credentials are provided by env.js file (API_URL, API_USERNAME, API_PASSWORD).
Credentials (API_USERNAME, API_PASSWORD) are intended for local use only.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"export const timeoutProvider = {\n setTimeout(handler, timeout, ...args) {\n const {\n delegate\n } = timeoutProvider;\n if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const {\n delegate\n } = timeoutProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);\n },\n delegate: undefined\n};\n//# sourceMappingURL=timeoutProvider.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function every(predicate, thisArg) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n if (!predicate.call(thisArg, value, index++, source)) {\n subscriber.next(false);\n subscriber.complete();\n }\n }, () => {\n subscriber.next(true);\n subscriber.complete();\n }));\n });\n}\n//# sourceMappingURL=every.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { concat } from '../observable/concat';\nimport { take } from './take';\nimport { ignoreElements } from './ignoreElements';\nimport { mapTo } from './mapTo';\nimport { mergeMap } from './mergeMap';\nimport { innerFrom } from '../observable/innerFrom';\nexport function delayWhen(delayDurationSelector, subscriptionDelay) {\n if (subscriptionDelay) {\n return source => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));\n }\n return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));\n}\n//# sourceMappingURL=delayWhen.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { identity } from '../util/identity';\nimport { isScheduler } from '../util/isScheduler';\nimport { defer } from './defer';\nimport { scheduleIterable } from '../scheduled/scheduleIterable';\nexport function generate(initialStateOrOptions, condition, iterate, resultSelectorOrScheduler, scheduler) {\n let resultSelector;\n let initialState;\n if (arguments.length === 1) {\n ({\n initialState,\n condition,\n iterate,\n resultSelector = identity,\n scheduler\n } = initialStateOrOptions);\n } else {\n initialState = initialStateOrOptions;\n if (!resultSelectorOrScheduler || isScheduler(resultSelectorOrScheduler)) {\n resultSelector = identity;\n scheduler = resultSelectorOrScheduler;\n } else {\n resultSelector = resultSelectorOrScheduler;\n }\n }\n function* gen() {\n for (let state = initialState; !condition || condition(state); state = iterate(state)) {\n yield resultSelector(state);\n }\n }\n return defer(scheduler ? () => scheduleIterable(gen(), scheduler) : gen);\n}\n//# sourceMappingURL=generate.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from './isFunction';\nexport function isIterable(input) {\n return isFunction(input === null || input === void 0 ? void 0 : input[Symbol_iterator]);\n}\n//# sourceMappingURL=isIterable.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { Subject } from './Subject';\nexport class AsyncSubject extends Subject {\n constructor() {\n super(...arguments);\n this._value = null;\n this._hasValue = false;\n this._isComplete = false;\n }\n _checkFinalizedStatuses(subscriber) {\n const {\n hasError,\n _hasValue,\n _value,\n thrownError,\n isStopped,\n _isComplete\n } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped || _isComplete) {\n _hasValue && subscriber.next(_value);\n subscriber.complete();\n }\n }\n next(value) {\n if (!this.isStopped) {\n this._value = value;\n this._hasValue = true;\n }\n }\n complete() {\n const {\n _hasValue,\n _value,\n _isComplete\n } = this;\n if (!_isComplete) {\n this._isComplete = true;\n _hasValue && super.next(_value);\n super.complete();\n }\n }\n}\n//# sourceMappingURL=AsyncSubject.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { filter } from './filter';\nexport function skip(count) {\n return filter((_, index) => count <= index);\n}\n//# sourceMappingURL=skip.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { Subscription } from '../Subscription';\nimport { operate } from '../util/lift';\nimport { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\nimport { arrRemove } from '../util/arrRemove';\nexport function bufferToggle(openings, closingSelector) {\n return operate((source, subscriber) => {\n const buffers = [];\n innerFrom(openings).subscribe(createOperatorSubscriber(subscriber, openValue => {\n const buffer = [];\n buffers.push(buffer);\n const closingSubscription = new Subscription();\n const emitBuffer = () => {\n arrRemove(buffers, buffer);\n subscriber.next(buffer);\n closingSubscription.unsubscribe();\n };\n closingSubscription.add(innerFrom(closingSelector(openValue)).subscribe(createOperatorSubscriber(subscriber, emitBuffer, noop)));\n }, noop));\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n for (const buffer of buffers) {\n buffer.push(value);\n }\n }, () => {\n while (buffers.length > 0) {\n subscriber.next(buffers.shift());\n }\n subscriber.complete();\n }));\n });\n}\n//# sourceMappingURL=bufferToggle.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { raceInit } from '../observable/race';\nimport { operate } from '../util/lift';\nimport { identity } from '../util/identity';\nexport function raceWith(...otherSources) {\n return !otherSources.length ? identity : operate((source, subscriber) => {\n raceInit([source, ...otherSources])(subscriber);\n });\n}\n//# sourceMappingURL=raceWith.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { Observable } from '../Observable';\nimport { isFunction } from '../util/isFunction';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nexport function fromEventPattern(addHandler, removeHandler, resultSelector) {\n if (resultSelector) {\n return fromEventPattern(addHandler, removeHandler).pipe(mapOneOrManyArgs(resultSelector));\n }\n return new Observable(subscriber => {\n const handler = (...e) => subscriber.next(e.length === 1 ? e[0] : e);\n const retValue = addHandler(handler);\n return isFunction(removeHandler) ? () => removeHandler(handler, retValue) : undefined;\n });\n}\n//# sourceMappingURL=fromEventPattern.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { AnimationFrameAction } from './AnimationFrameAction';\nimport { AnimationFrameScheduler } from './AnimationFrameScheduler';\nexport const animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction);\nexport const animationFrame = animationFrameScheduler;\n//# sourceMappingURL=animationFrame.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { asyncScheduler } from '../scheduler/async';\nimport { audit } from './audit';\nimport { timer } from '../observable/timer';\nexport function auditTime(duration, scheduler = asyncScheduler) {\n return audit(() => timer(duration, scheduler));\n}\n//# sourceMappingURL=auditTime.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import { createErrorClass } from './createErrorClass';\nexport const SequenceError = createErrorClass(_super => function SequenceErrorImpl(message) {\n _super(this);\n this.name = 'SequenceError';\n this.message = message;\n});\n//# sourceMappingURL=SequenceError.js.map","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import logger from \"../modules/logger/index.js\";\nvar name = \"webpack-dev-server\";\n// default level is set on the client side, so it does not need\n// to be set by the CLI or API\nvar defaultLevel = \"info\";\n\n// options new options, merge with old options\n/**\n * @param {false | true | \"none\" | \"error\" | \"warn\" | \"info\" | \"log\" | \"verbose\"} level\n * @returns {void}\n */\nfunction setLogLevel(level) {\n logger.configureDefaultLogger({\n level: level\n });\n}\nsetLogLevel(defaultLevel);\nvar log = logger.getLogger(name);\nvar logEnabledFeatures = function logEnabledFeatures(features) {\n var enabledFeatures = Object.keys(features);\n if (!features || enabledFeatures.length === 0) {\n return;\n }\n var logString = \"Server started:\";\n\n // Server started: Hot Module Replacement enabled, Live Reloading enabled, Overlay disabled.\n for (var i = 0; i < enabledFeatures.length; i++) {\n var key = enabledFeatures[i];\n logString += \" \".concat(key, \" \").concat(features[key] ? \"enabled\" : \"disabled\", \",\");\n }\n // replace last comma with a period\n logString = logString.slice(0, -1).concat(\".\");\n log.info(logString);\n};\nexport { log, logEnabledFeatures, setLogLevel };","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ast":null,"code":"import createMachine from \"./fsm.js\";\n\n/**\n * @typedef {Object} ShowOverlayData\n * @property {'warning' | 'error'} level\n * @property {Array<string | { moduleIdentifier?: string, moduleName?: string, loc?: string, message?: string }>} messages\n * @property {'build' | 'runtime'} messageSource\n */\n\n/**\n * @typedef {Object} CreateOverlayMachineOptions\n * @property {(data: ShowOverlayData) => void} showOverlay\n * @property {() => void} hideOverlay\n */\n\n/**\n * @param {CreateOverlayMachineOptions} options\n */\nvar createOverlayMachine = function createOverlayMachine(options) {\n var hideOverlay = options.hideOverlay,\n showOverlay = options.showOverlay;\n var overlayMachine = createMachine({\n initial: \"hidden\",\n context: {\n level: \"error\",\n messages: [],\n messageSource: \"build\"\n },\n states: {\n hidden: {\n on: {\n BUILD_ERROR: {\n target: \"displayBuildError\",\n actions: [\"setMessages\", \"showOverlay\"]\n },\n RUNTIME_ERROR: {\n target: \"displayRuntimeError\",\n actions: [\"setMessages\", \"showOverlay\"]\n }\n }\n },\n displayBuildError: {\n on: {\n DISMISS: {\n target: \"hidden\",\n actions: [\"dismissMessages\", \"hideOverlay\"]\n },\n BUILD_ERROR: {\n target: \"displayBuildError\",\n actions: [\"appendMessages\", \"showOverlay\"]\n }\n }\n },\n displayRuntimeError: {\n on: {\n DISMISS: {\n target: \"hidden\",\n actions: [\"dismissMessages\", \"hideOverlay\"]\n },\n RUNTIME_ERROR: {\n target: \"displayRuntimeError\",\n actions: [\"appendMessages\", \"showOverlay\"]\n },\n BUILD_ERROR: {\n target: \"displayBuildError\",\n actions: [\"setMessages\", \"showOverlay\"]\n }\n }\n }\n }\n }, {\n actions: {\n dismissMessages: function dismissMessages() {\n return {\n messages: [],\n level: \"error\",\n messageSource: \"build\"\n };\n },\n appendMessages: function appendMessages(context, event) {\n return {\n messages: context.messages.concat(event.messages),\n level: event.level || context.level,\n messageSource: event.type === \"RUNTIME_ERROR\" ? \"runtime\" : \"build\"\n };\n },\n setMessages: function setMessages(context, event) {\n return {\n messages: event.messages,\n level: event.level || context.level,\n messageSource: event.type === \"RUNTIME_ERROR\" ? \"runtime\" : \"build\"\n };\n },\n hideOverlay: hideOverlay,\n showOverlay: showOverlay\n }\n });\n return overlayMachine;\n};\nexport default createOverlayMachine;","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
Loading
Loading