@blazedpath/commons 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/blz-base/health/index.d.ts +1 -0
- package/dist/blz-base/health/index.js +1 -0
- package/dist/blz-base/index.d.ts +108 -0
- package/dist/blz-base/index.js +1 -0
- package/dist/blz-cache/LruCache.d.ts +31 -0
- package/dist/blz-cache/LruCache.js +1 -0
- package/dist/blz-cache/index.d.ts +2 -0
- package/dist/blz-cache/index.js +1 -0
- package/dist/blz-config/index.d.ts +16 -0
- package/dist/blz-config/index.js +1 -0
- package/dist/blz-core/index.d.ts +32 -0
- package/dist/blz-core/index.js +1 -0
- package/dist/blz-cryptography/index.d.ts +2 -0
- package/dist/blz-cryptography/index.js +1 -0
- package/dist/blz-datetimes/index.d.ts +35 -0
- package/dist/blz-datetimes/index.js +1 -0
- package/dist/blz-file/fileService.d.ts +25 -0
- package/dist/blz-file/fileService.js +1 -0
- package/dist/blz-file/index.d.ts +2 -0
- package/dist/blz-file/index.js +1 -0
- package/dist/blz-file/index.test.js +1 -0
- package/dist/blz-file/lab.js +1 -0
- package/dist/blz-hazelcast/index.d.ts +25 -0
- package/dist/blz-hazelcast/index.js +1 -0
- package/dist/blz-hazelcast/lib/credentials.d.ts +10 -0
- package/dist/blz-hazelcast/lib/credentials.js +1 -0
- package/dist/blz-hazelcast/lib/credentialsFactory.d.ts +1 -0
- package/dist/blz-hazelcast/lib/credentialsFactory.js +1 -0
- package/dist/blz-hazelcast/lib/hazelcastCache.d.ts +27 -0
- package/dist/blz-hazelcast/lib/hazelcastCache.js +1 -0
- package/dist/blz-iterable/index.d.ts +49 -0
- package/dist/blz-iterable/index.js +1 -0
- package/dist/blz-json-schema/index.d.ts +1 -0
- package/dist/blz-json-schema/index.js +1 -0
- package/dist/blz-jwt/index.d.ts +12 -0
- package/dist/blz-jwt/index.js +1 -0
- package/dist/blz-kafka/index.d.ts +9 -0
- package/dist/blz-kafka/index.js +1 -0
- package/dist/blz-math/index.d.ts +22 -0
- package/dist/blz-math/index.js +1 -0
- package/dist/blz-mongodb/index.d.ts +28 -0
- package/dist/blz-mongodb/index.js +1 -0
- package/dist/blz-rds/__test__/scape.test.js +1 -0
- package/dist/blz-rds/blz-rds-executor.d.ts +4 -0
- package/dist/blz-rds/blz-rds-executor.js +1 -0
- package/dist/blz-rds/blz-rds-helper.d.ts +5 -0
- package/dist/blz-rds/blz-rds-helper.js +1 -0
- package/dist/blz-rds/commands/core/add.d.ts +2 -0
- package/dist/blz-rds/commands/core/add.js +1 -0
- package/dist/blz-rds/commands/core/and.d.ts +3 -0
- package/dist/blz-rds/commands/core/and.js +1 -0
- package/dist/blz-rds/commands/core/asc.d.ts +2 -0
- package/dist/blz-rds/commands/core/asc.js +1 -0
- package/dist/blz-rds/commands/core/avg.d.ts +2 -0
- package/dist/blz-rds/commands/core/avg.js +1 -0
- package/dist/blz-rds/commands/core/column-ref.d.ts +2 -0
- package/dist/blz-rds/commands/core/column-ref.js +1 -0
- package/dist/blz-rds/commands/core/count-distinct.d.ts +2 -0
- package/dist/blz-rds/commands/core/count-distinct.js +1 -0
- package/dist/blz-rds/commands/core/count.d.ts +2 -0
- package/dist/blz-rds/commands/core/count.js +1 -0
- package/dist/blz-rds/commands/core/decimal.d.ts +2 -0
- package/dist/blz-rds/commands/core/decimal.js +1 -0
- package/dist/blz-rds/commands/core/desc.d.ts +2 -0
- package/dist/blz-rds/commands/core/desc.js +1 -0
- package/dist/blz-rds/commands/core/distinct.d.ts +2 -0
- package/dist/blz-rds/commands/core/distinct.js +1 -0
- package/dist/blz-rds/commands/core/divide.d.ts +2 -0
- package/dist/blz-rds/commands/core/divide.js +1 -0
- package/dist/blz-rds/commands/core/embedded-exists.d.ts +3 -0
- package/dist/blz-rds/commands/core/embedded-exists.js +1 -0
- package/dist/blz-rds/commands/core/embedded-select.d.ts +2 -0
- package/dist/blz-rds/commands/core/embedded-select.js +1 -0
- package/dist/blz-rds/commands/core/equals.d.ts +3 -0
- package/dist/blz-rds/commands/core/equals.js +1 -0
- package/dist/blz-rds/commands/core/false.d.ts +2 -0
- package/dist/blz-rds/commands/core/false.js +1 -0
- package/dist/blz-rds/commands/core/greater-or-equal.d.ts +3 -0
- package/dist/blz-rds/commands/core/greater-or-equal.js +1 -0
- package/dist/blz-rds/commands/core/greater.d.ts +3 -0
- package/dist/blz-rds/commands/core/greater.js +1 -0
- package/dist/blz-rds/commands/core/in.d.ts +3 -0
- package/dist/blz-rds/commands/core/in.js +1 -0
- package/dist/blz-rds/commands/core/integer.d.ts +2 -0
- package/dist/blz-rds/commands/core/integer.js +1 -0
- package/dist/blz-rds/commands/core/is-not-null.d.ts +3 -0
- package/dist/blz-rds/commands/core/is-not-null.js +1 -0
- package/dist/blz-rds/commands/core/is-null-or-value.d.ts +3 -0
- package/dist/blz-rds/commands/core/is-null-or-value.js +1 -0
- package/dist/blz-rds/commands/core/is-null.d.ts +3 -0
- package/dist/blz-rds/commands/core/is-null.js +1 -0
- package/dist/blz-rds/commands/core/less-or-equal.d.ts +3 -0
- package/dist/blz-rds/commands/core/less-or-equal.js +1 -0
- package/dist/blz-rds/commands/core/less-unary.d.ts +2 -0
- package/dist/blz-rds/commands/core/less-unary.js +1 -0
- package/dist/blz-rds/commands/core/less.d.ts +3 -0
- package/dist/blz-rds/commands/core/less.js +1 -0
- package/dist/blz-rds/commands/core/like.d.ts +3 -0
- package/dist/blz-rds/commands/core/like.js +1 -0
- package/dist/blz-rds/commands/core/max.d.ts +2 -0
- package/dist/blz-rds/commands/core/max.js +1 -0
- package/dist/blz-rds/commands/core/min.d.ts +2 -0
- package/dist/blz-rds/commands/core/min.js +1 -0
- package/dist/blz-rds/commands/core/multiply.d.ts +2 -0
- package/dist/blz-rds/commands/core/multiply.js +1 -0
- package/dist/blz-rds/commands/core/not-equals.d.ts +3 -0
- package/dist/blz-rds/commands/core/not-equals.js +1 -0
- package/dist/blz-rds/commands/core/not-in.d.ts +3 -0
- package/dist/blz-rds/commands/core/not-in.js +1 -0
- package/dist/blz-rds/commands/core/not.d.ts +3 -0
- package/dist/blz-rds/commands/core/not.js +1 -0
- package/dist/blz-rds/commands/core/null.d.ts +2 -0
- package/dist/blz-rds/commands/core/null.js +1 -0
- package/dist/blz-rds/commands/core/nvl.d.ts +2 -0
- package/dist/blz-rds/commands/core/nvl.js +1 -0
- package/dist/blz-rds/commands/core/or.d.ts +3 -0
- package/dist/blz-rds/commands/core/or.js +1 -0
- package/dist/blz-rds/commands/core/parameter.d.ts +2 -0
- package/dist/blz-rds/commands/core/parameter.js +1 -0
- package/dist/blz-rds/commands/core/remainder.d.ts +2 -0
- package/dist/blz-rds/commands/core/remainder.js +1 -0
- package/dist/blz-rds/commands/core/string.d.ts +2 -0
- package/dist/blz-rds/commands/core/string.js +1 -0
- package/dist/blz-rds/commands/core/subtract.d.ts +2 -0
- package/dist/blz-rds/commands/core/subtract.js +1 -0
- package/dist/blz-rds/commands/core/sum.d.ts +2 -0
- package/dist/blz-rds/commands/core/sum.js +1 -0
- package/dist/blz-rds/commands/core/true.d.ts +2 -0
- package/dist/blz-rds/commands/core/true.js +1 -0
- package/dist/blz-rds/commands/core/tuple.d.ts +2 -0
- package/dist/blz-rds/commands/core/tuple.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-days.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-days.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-hours.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-hours.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-milliseconds.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-milliseconds.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-minutes.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-minutes.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-months.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-months.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-seconds.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-seconds.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-years.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-years.js +1 -0
- package/dist/blz-rds/commands/datetimes/date-diff.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/date-diff.js +1 -0
- package/dist/blz-rds/commands/datetimes/date.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/date.js +1 -0
- package/dist/blz-rds/commands/datetimes/datetime-diff.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/datetime-diff.js +1 -0
- package/dist/blz-rds/commands/datetimes/datetime.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/datetime.js +1 -0
- package/dist/blz-rds/commands/datetimes/day.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/day.js +1 -0
- package/dist/blz-rds/commands/datetimes/hour.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/hour.js +1 -0
- package/dist/blz-rds/commands/datetimes/millisecond.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/millisecond.js +1 -0
- package/dist/blz-rds/commands/datetimes/minute.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/minute.js +1 -0
- package/dist/blz-rds/commands/datetimes/month-text.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/month-text.js +1 -0
- package/dist/blz-rds/commands/datetimes/month.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/month.js +1 -0
- package/dist/blz-rds/commands/datetimes/now.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/now.js +1 -0
- package/dist/blz-rds/commands/datetimes/second.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/second.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-days.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-days.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-hours.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-hours.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-milliseconds.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-milliseconds.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-minutes.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-minutes.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-seconds.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-seconds.js +1 -0
- package/dist/blz-rds/commands/datetimes/time-diff.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/time-diff.js +1 -0
- package/dist/blz-rds/commands/datetimes/time.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/time.js +1 -0
- package/dist/blz-rds/commands/datetimes/today.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/today.js +1 -0
- package/dist/blz-rds/commands/datetimes/week-day-text.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/week-day-text.js +1 -0
- package/dist/blz-rds/commands/datetimes/week-day.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/week-day.js +1 -0
- package/dist/blz-rds/commands/datetimes/week.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/week.js +1 -0
- package/dist/blz-rds/commands/datetimes/year.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/year.js +1 -0
- package/dist/blz-rds/commands/math/abs.d.ts +2 -0
- package/dist/blz-rds/commands/math/abs.js +1 -0
- package/dist/blz-rds/commands/math/acos.d.ts +2 -0
- package/dist/blz-rds/commands/math/acos.js +1 -0
- package/dist/blz-rds/commands/math/asin.d.ts +2 -0
- package/dist/blz-rds/commands/math/asin.js +1 -0
- package/dist/blz-rds/commands/math/atan.d.ts +2 -0
- package/dist/blz-rds/commands/math/atan.js +1 -0
- package/dist/blz-rds/commands/math/atan2.d.ts +2 -0
- package/dist/blz-rds/commands/math/atan2.js +1 -0
- package/dist/blz-rds/commands/math/ceil.d.ts +2 -0
- package/dist/blz-rds/commands/math/ceil.js +1 -0
- package/dist/blz-rds/commands/math/cos.d.ts +2 -0
- package/dist/blz-rds/commands/math/cos.js +1 -0
- package/dist/blz-rds/commands/math/cosh.d.ts +2 -0
- package/dist/blz-rds/commands/math/cosh.js +1 -0
- package/dist/blz-rds/commands/math/exp.d.ts +2 -0
- package/dist/blz-rds/commands/math/exp.js +1 -0
- package/dist/blz-rds/commands/math/floor.d.ts +2 -0
- package/dist/blz-rds/commands/math/floor.js +1 -0
- package/dist/blz-rds/commands/math/log.d.ts +2 -0
- package/dist/blz-rds/commands/math/log.js +1 -0
- package/dist/blz-rds/commands/math/log10.d.ts +2 -0
- package/dist/blz-rds/commands/math/log10.js +1 -0
- package/dist/blz-rds/commands/math/pow.d.ts +2 -0
- package/dist/blz-rds/commands/math/pow.js +1 -0
- package/dist/blz-rds/commands/math/random.d.ts +2 -0
- package/dist/blz-rds/commands/math/random.js +1 -0
- package/dist/blz-rds/commands/math/round.d.ts +2 -0
- package/dist/blz-rds/commands/math/round.js +1 -0
- package/dist/blz-rds/commands/math/sign.d.ts +2 -0
- package/dist/blz-rds/commands/math/sign.js +1 -0
- package/dist/blz-rds/commands/math/sin.d.ts +2 -0
- package/dist/blz-rds/commands/math/sin.js +1 -0
- package/dist/blz-rds/commands/math/sinh.d.ts +2 -0
- package/dist/blz-rds/commands/math/sinh.js +1 -0
- package/dist/blz-rds/commands/math/sqrt.d.ts +2 -0
- package/dist/blz-rds/commands/math/sqrt.js +1 -0
- package/dist/blz-rds/commands/math/tan.d.ts +2 -0
- package/dist/blz-rds/commands/math/tan.js +1 -0
- package/dist/blz-rds/commands/math/tanh.d.ts +2 -0
- package/dist/blz-rds/commands/math/tanh.js +1 -0
- package/dist/blz-rds/commands/math/trunc.d.ts +2 -0
- package/dist/blz-rds/commands/math/trunc.js +1 -0
- package/dist/blz-rds/commands/strings/concat.d.ts +2 -0
- package/dist/blz-rds/commands/strings/concat.js +1 -0
- package/dist/blz-rds/commands/strings/contains.d.ts +3 -0
- package/dist/blz-rds/commands/strings/contains.js +1 -0
- package/dist/blz-rds/commands/strings/ends-with.d.ts +3 -0
- package/dist/blz-rds/commands/strings/ends-with.js +1 -0
- package/dist/blz-rds/commands/strings/index-of.d.ts +2 -0
- package/dist/blz-rds/commands/strings/index-of.js +1 -0
- package/dist/blz-rds/commands/strings/is-null-or-empty.d.ts +3 -0
- package/dist/blz-rds/commands/strings/is-null-or-empty.js +1 -0
- package/dist/blz-rds/commands/strings/is-null-or-white-space.d.ts +3 -0
- package/dist/blz-rds/commands/strings/is-null-or-white-space.js +1 -0
- package/dist/blz-rds/commands/strings/join.d.ts +2 -0
- package/dist/blz-rds/commands/strings/join.js +1 -0
- package/dist/blz-rds/commands/strings/last-index-of.d.ts +2 -0
- package/dist/blz-rds/commands/strings/last-index-of.js +1 -0
- package/dist/blz-rds/commands/strings/length.d.ts +2 -0
- package/dist/blz-rds/commands/strings/length.js +1 -0
- package/dist/blz-rds/commands/strings/pad-left.d.ts +2 -0
- package/dist/blz-rds/commands/strings/pad-left.js +1 -0
- package/dist/blz-rds/commands/strings/pad-right.d.ts +2 -0
- package/dist/blz-rds/commands/strings/pad-right.js +1 -0
- package/dist/blz-rds/commands/strings/replace.d.ts +2 -0
- package/dist/blz-rds/commands/strings/replace.js +1 -0
- package/dist/blz-rds/commands/strings/starts-with.d.ts +3 -0
- package/dist/blz-rds/commands/strings/starts-with.js +1 -0
- package/dist/blz-rds/commands/strings/substring.d.ts +2 -0
- package/dist/blz-rds/commands/strings/substring.js +1 -0
- package/dist/blz-rds/commands/strings/to-lower.d.ts +2 -0
- package/dist/blz-rds/commands/strings/to-lower.js +1 -0
- package/dist/blz-rds/commands/strings/to-upper.d.ts +2 -0
- package/dist/blz-rds/commands/strings/to-upper.js +1 -0
- package/dist/blz-rds/commands/strings/trim-end.d.ts +2 -0
- package/dist/blz-rds/commands/strings/trim-end.js +1 -0
- package/dist/blz-rds/commands/strings/trim-start.d.ts +2 -0
- package/dist/blz-rds/commands/strings/trim-start.js +1 -0
- package/dist/blz-rds/commands/strings/trim.d.ts +2 -0
- package/dist/blz-rds/commands/strings/trim.js +1 -0
- package/dist/blz-rds/index.d.ts +53 -0
- package/dist/blz-rds/index.js +1 -0
- package/dist/blz-rds-mysql/base.d.ts +83 -0
- package/dist/blz-rds-mysql/base.js +1 -0
- package/dist/blz-rds-mysql/connection-manager.d.ts +8 -0
- package/dist/blz-rds-mysql/connection-manager.js +1 -0
- package/dist/blz-rds-mysql/execute-bulk-insert.d.ts +2 -0
- package/dist/blz-rds-mysql/execute-bulk-insert.js +1 -0
- package/dist/blz-rds-mysql/execute-bulk-merge.d.ts +2 -0
- package/dist/blz-rds-mysql/execute-bulk-merge.js +1 -0
- package/dist/blz-rds-mysql/execute-non-query.d.ts +14 -0
- package/dist/blz-rds-mysql/execute-non-query.js +1 -0
- package/dist/blz-rds-mysql/execute-query.d.ts +11 -0
- package/dist/blz-rds-mysql/execute-query.js +1 -0
- package/dist/blz-rds-mysql/index.d.ts +9 -0
- package/dist/blz-rds-mysql/index.js +1 -0
- package/dist/blz-rds-mysql/stored-procedure.d.ts +19 -0
- package/dist/blz-rds-mysql/stored-procedure.js +1 -0
- package/dist/blz-rds-mysqlx/base.d.ts +83 -0
- package/dist/blz-rds-mysqlx/base.js +1 -0
- package/dist/blz-rds-mysqlx/connection-manager.d.ts +6 -0
- package/dist/blz-rds-mysqlx/connection-manager.js +1 -0
- package/dist/blz-rds-mysqlx/execute-bulk-insert.d.ts +2 -0
- package/dist/blz-rds-mysqlx/execute-bulk-insert.js +1 -0
- package/dist/blz-rds-mysqlx/execute-bulk-merge.d.ts +2 -0
- package/dist/blz-rds-mysqlx/execute-bulk-merge.js +1 -0
- package/dist/blz-rds-mysqlx/execute-non-query.d.ts +4 -0
- package/dist/blz-rds-mysqlx/execute-non-query.js +1 -0
- package/dist/blz-rds-mysqlx/execute-query.d.ts +7 -0
- package/dist/blz-rds-mysqlx/execute-query.js +1 -0
- package/dist/blz-rds-mysqlx/index.d.ts +9 -0
- package/dist/blz-rds-mysqlx/index.js +1 -0
- package/dist/blz-rds-mysqlx/stored-procedure.d.ts +20 -0
- package/dist/blz-rds-mysqlx/stored-procedure.js +1 -0
- package/dist/blz-rds-oracle/index.d.ts +25 -0
- package/dist/blz-rds-oracle/index.js +1 -0
- package/dist/blz-rds-postgres/base.d.ts +94 -0
- package/dist/blz-rds-postgres/base.js +1 -0
- package/dist/blz-rds-postgres/connection-manager.d.ts +6 -0
- package/dist/blz-rds-postgres/connection-manager.js +1 -0
- package/dist/blz-rds-postgres/execute-bulk-insert.d.ts +5 -0
- package/dist/blz-rds-postgres/execute-bulk-insert.js +1 -0
- package/dist/blz-rds-postgres/execute-bulk-merge.d.ts +4 -0
- package/dist/blz-rds-postgres/execute-bulk-merge.js +1 -0
- package/dist/blz-rds-postgres/execute-non-query.d.ts +12 -0
- package/dist/blz-rds-postgres/execute-non-query.js +1 -0
- package/dist/blz-rds-postgres/execute-query.d.ts +4 -0
- package/dist/blz-rds-postgres/execute-query.js +1 -0
- package/dist/blz-rds-postgres/index.d.ts +9 -0
- package/dist/blz-rds-postgres/index.js +1 -0
- package/dist/blz-rds-postgres/result-set.js +1 -0
- package/dist/blz-rds-postgres/stored-procedure.d.ts +19 -0
- package/dist/blz-rds-postgres/stored-procedure.js +1 -0
- package/dist/blz-redis/index.d.ts +31 -0
- package/dist/blz-redis/index.js +1 -0
- package/dist/blz-redis/lib/redisCache.d.ts +33 -0
- package/dist/blz-redis/lib/redisCache.js +1 -0
- package/dist/blz-regex/index.d.ts +3 -0
- package/dist/blz-regex/index.js +1 -0
- package/dist/blz-security/__test__/autorization.test.js +1 -0
- package/dist/blz-security/__test__/autorizationKpn.test.js +1 -0
- package/dist/blz-security/__test__/orderManagement.test.js +1 -0
- package/dist/blz-security/__test__/secureUrl.test.js +1 -0
- package/dist/blz-security/__test__/solveMergeRule.test.js +1 -0
- package/dist/blz-security/__test__/sqlInjectionGuard.test.js +1 -0
- package/dist/blz-security/__test__/xssGuard.test.js +1 -0
- package/dist/blz-security/authorizationService.d.ts +42 -0
- package/dist/blz-security/authorizationService.js +2 -0
- package/dist/blz-security/config/global.js +1 -0
- package/dist/blz-security/filescanner/index.d.ts +24 -0
- package/dist/blz-security/filescanner/index.js +1 -0
- package/dist/blz-security/helpers/consts.d.ts +28 -0
- package/dist/blz-security/helpers/consts.js +1 -0
- package/dist/blz-security/helpers/utils.d.ts +82 -0
- package/dist/blz-security/helpers/utils.js +1 -0
- package/dist/blz-security/implementations/cache.d.ts +58 -0
- package/dist/blz-security/implementations/cache.js +1 -0
- package/dist/blz-security/implementations/oidc.d.ts +100 -0
- package/dist/blz-security/implementations/oidc.js +1 -0
- package/dist/blz-security/implementations/pkceCacheStore.d.ts +2 -0
- package/dist/blz-security/implementations/pkceCacheStore.js +1 -0
- package/dist/blz-security/implementations/saml.js +1 -0
- package/dist/blz-security/implementations/uma.d.ts +31 -0
- package/dist/blz-security/implementations/uma.js +1 -0
- package/dist/blz-security/implementations/webAuthn.js +1 -0
- package/dist/blz-security/implementations/wstg.js +1 -0
- package/dist/blz-security/index.d.ts +4 -0
- package/dist/blz-security/index.js +2 -0
- package/dist/blz-security/lab/index.js +1 -0
- package/dist/blz-security/middleware/HapiServerAzureAd.d.ts +26 -0
- package/dist/blz-security/middleware/HapiServerAzureAd.js +1 -0
- package/dist/blz-security/middleware/HapiServerKeycloak.d.ts +47 -0
- package/dist/blz-security/middleware/HapiServerKeycloak.js +1 -0
- package/dist/blz-security/middleware/HapiServerSimToken.d.ts +13 -0
- package/dist/blz-security/middleware/HapiServerSimToken.js +1 -0
- package/dist/blz-security/middleware/hapi.d.ts +14 -0
- package/dist/blz-security/middleware/hapi.js +1 -0
- package/dist/blz-security/middleware/hapiServer.js +1 -0
- package/dist/blz-security/navigationMemoryRepository.d.ts +6 -0
- package/dist/blz-security/navigationMemoryRepository.js +1 -0
- package/dist/blz-security/navigationMongoDbRepository.d.ts +15 -0
- package/dist/blz-security/navigationMongoDbRepository.js +1 -0
- package/dist/blz-security/secureUrlService.d.ts +7 -0
- package/dist/blz-security/secureUrlService.js +1 -0
- package/dist/blz-security/securityService.d.ts +72 -0
- package/dist/blz-security/securityService.js +1 -0
- package/dist/blz-security/sqlInjectionGuard.d.ts +37 -0
- package/dist/blz-security/sqlInjectionGuard.js +1 -0
- package/dist/blz-security/xssGuard.d.ts +14 -0
- package/dist/blz-security/xssGuard.js +1 -0
- package/dist/blz-strings/index.d.ts +42 -0
- package/dist/blz-strings/index.js +1 -0
- package/dist/blz-uuid/index.d.ts +1 -0
- package/dist/blz-uuid/index.js +1 -0
- package/dist/blz-yaml/index.d.ts +2 -0
- package/dist/blz-yaml/index.js +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +1 -0
- package/dist/process-managers/index.d.ts +25 -0
- package/dist/process-managers/index.js +1 -0
- package/package.json +52 -41
- package/blz-base/health/index.js +0 -215
- package/blz-base/index.js +0 -1466
- package/blz-cache/LruCache.js +0 -44
- package/blz-cache/index.js +0 -29
- package/blz-config/index.js +0 -434
- package/blz-core/index.js +0 -364
- package/blz-cryptography/index.js +0 -54
- package/blz-datetimes/index.js +0 -356
- package/blz-file/example.dat +0 -2545
- package/blz-file/fileService.js +0 -205
- package/blz-file/index.js +0 -94
- package/blz-file/index.test.js +0 -31
- package/blz-file/lab.js +0 -33
- package/blz-hazelcast/index.js +0 -189
- package/blz-hazelcast/lib/credentials.js +0 -25
- package/blz-hazelcast/lib/credentialsFactory.js +0 -12
- package/blz-hazelcast/lib/hazelcastCache.js +0 -234
- package/blz-iterable/index.js +0 -446
- package/blz-json-schema/index.js +0 -11
- package/blz-jwt/index.js +0 -121
- package/blz-kafka/index.js +0 -522
- package/blz-math/index.js +0 -131
- package/blz-mongodb/index.js +0 -326
- package/blz-rds/__test__/scape.test.js +0 -58
- package/blz-rds/blz-rds-executor.js +0 -578
- package/blz-rds/blz-rds-helper.js +0 -310
- package/blz-rds/commands/core/add.js +0 -13
- package/blz-rds/commands/core/and.js +0 -18
- package/blz-rds/commands/core/asc.js +0 -10
- package/blz-rds/commands/core/avg.js +0 -10
- package/blz-rds/commands/core/column-ref.js +0 -8
- package/blz-rds/commands/core/count-distinct.js +0 -10
- package/blz-rds/commands/core/count.js +0 -10
- package/blz-rds/commands/core/decimal.js +0 -8
- package/blz-rds/commands/core/desc.js +0 -10
- package/blz-rds/commands/core/distinct.js +0 -10
- package/blz-rds/commands/core/divide.js +0 -11
- package/blz-rds/commands/core/embedded-exists.js +0 -17
- package/blz-rds/commands/core/embedded-select.js +0 -17
- package/blz-rds/commands/core/equals.js +0 -9
- package/blz-rds/commands/core/false.js +0 -8
- package/blz-rds/commands/core/greater-or-equal.js +0 -9
- package/blz-rds/commands/core/greater.js +0 -9
- package/blz-rds/commands/core/in.js +0 -9
- package/blz-rds/commands/core/integer.js +0 -8
- package/blz-rds/commands/core/is-not-null.js +0 -11
- package/blz-rds/commands/core/is-null-or-value.js +0 -10
- package/blz-rds/commands/core/is-null.js +0 -11
- package/blz-rds/commands/core/less-or-equal.js +0 -9
- package/blz-rds/commands/core/less-unary.js +0 -12
- package/blz-rds/commands/core/less.js +0 -9
- package/blz-rds/commands/core/like.js +0 -12
- package/blz-rds/commands/core/max.js +0 -10
- package/blz-rds/commands/core/min.js +0 -10
- package/blz-rds/commands/core/multiply.js +0 -13
- package/blz-rds/commands/core/not-equals.js +0 -9
- package/blz-rds/commands/core/not-in.js +0 -9
- package/blz-rds/commands/core/not.js +0 -13
- package/blz-rds/commands/core/null.js +0 -8
- package/blz-rds/commands/core/nvl.js +0 -11
- package/blz-rds/commands/core/or.js +0 -13
- package/blz-rds/commands/core/parameter.js +0 -34
- package/blz-rds/commands/core/remainder.js +0 -16
- package/blz-rds/commands/core/string.js +0 -8
- package/blz-rds/commands/core/subtract.js +0 -13
- package/blz-rds/commands/core/sum.js +0 -10
- package/blz-rds/commands/core/true.js +0 -8
- package/blz-rds/commands/core/tuple.js +0 -13
- package/blz-rds/commands/datetimes/add-days.js +0 -11
- package/blz-rds/commands/datetimes/add-hours.js +0 -11
- package/blz-rds/commands/datetimes/add-milliseconds.js +0 -11
- package/blz-rds/commands/datetimes/add-minutes.js +0 -11
- package/blz-rds/commands/datetimes/add-months.js +0 -11
- package/blz-rds/commands/datetimes/add-seconds.js +0 -11
- package/blz-rds/commands/datetimes/add-years.js +0 -11
- package/blz-rds/commands/datetimes/date-diff.js +0 -11
- package/blz-rds/commands/datetimes/date.js +0 -12
- package/blz-rds/commands/datetimes/datetime-diff.js +0 -11
- package/blz-rds/commands/datetimes/datetime.js +0 -15
- package/blz-rds/commands/datetimes/day.js +0 -10
- package/blz-rds/commands/datetimes/hour.js +0 -10
- package/blz-rds/commands/datetimes/millisecond.js +0 -10
- package/blz-rds/commands/datetimes/minute.js +0 -10
- package/blz-rds/commands/datetimes/month-text.js +0 -10
- package/blz-rds/commands/datetimes/month.js +0 -10
- package/blz-rds/commands/datetimes/now.js +0 -9
- package/blz-rds/commands/datetimes/second.js +0 -10
- package/blz-rds/commands/datetimes/subtract-days.js +0 -11
- package/blz-rds/commands/datetimes/subtract-hours.js +0 -11
- package/blz-rds/commands/datetimes/subtract-milliseconds.js +0 -11
- package/blz-rds/commands/datetimes/subtract-minutes.js +0 -11
- package/blz-rds/commands/datetimes/subtract-seconds.js +0 -11
- package/blz-rds/commands/datetimes/time-diff.js +0 -11
- package/blz-rds/commands/datetimes/time.js +0 -13
- package/blz-rds/commands/datetimes/today.js +0 -9
- package/blz-rds/commands/datetimes/week-day-text.js +0 -10
- package/blz-rds/commands/datetimes/week-day.js +0 -10
- package/blz-rds/commands/datetimes/week.js +0 -10
- package/blz-rds/commands/datetimes/year.js +0 -10
- package/blz-rds/commands/math/abs.js +0 -10
- package/blz-rds/commands/math/acos.js +0 -10
- package/blz-rds/commands/math/asin.js +0 -10
- package/blz-rds/commands/math/atan.js +0 -10
- package/blz-rds/commands/math/atan2.js +0 -11
- package/blz-rds/commands/math/ceil.js +0 -10
- package/blz-rds/commands/math/cos.js +0 -10
- package/blz-rds/commands/math/cosh.js +0 -10
- package/blz-rds/commands/math/exp.js +0 -10
- package/blz-rds/commands/math/floor.js +0 -10
- package/blz-rds/commands/math/log.js +0 -18
- package/blz-rds/commands/math/log10.js +0 -10
- package/blz-rds/commands/math/pow.js +0 -11
- package/blz-rds/commands/math/random.js +0 -9
- package/blz-rds/commands/math/round.js +0 -18
- package/blz-rds/commands/math/sign.js +0 -10
- package/blz-rds/commands/math/sin.js +0 -10
- package/blz-rds/commands/math/sinh.js +0 -10
- package/blz-rds/commands/math/sqrt.js +0 -10
- package/blz-rds/commands/math/tan.js +0 -10
- package/blz-rds/commands/math/tanh.js +0 -10
- package/blz-rds/commands/math/trunc.js +0 -18
- package/blz-rds/commands/strings/concat.js +0 -20
- package/blz-rds/commands/strings/contains.js +0 -12
- package/blz-rds/commands/strings/ends-with.js +0 -12
- package/blz-rds/commands/strings/index-of.js +0 -11
- package/blz-rds/commands/strings/is-null-or-empty.js +0 -11
- package/blz-rds/commands/strings/is-null-or-white-space.js +0 -11
- package/blz-rds/commands/strings/join.js +0 -22
- package/blz-rds/commands/strings/last-index-of.js +0 -11
- package/blz-rds/commands/strings/length.js +0 -10
- package/blz-rds/commands/strings/pad-left.js +0 -20
- package/blz-rds/commands/strings/pad-right.js +0 -20
- package/blz-rds/commands/strings/replace.js +0 -12
- package/blz-rds/commands/strings/starts-with.js +0 -12
- package/blz-rds/commands/strings/substring.js +0 -12
- package/blz-rds/commands/strings/to-lower.js +0 -10
- package/blz-rds/commands/strings/to-upper.js +0 -10
- package/blz-rds/commands/strings/trim-end.js +0 -10
- package/blz-rds/commands/strings/trim-start.js +0 -10
- package/blz-rds/commands/strings/trim.js +0 -10
- package/blz-rds/index.js +0 -744
- package/blz-rds-mysql/base.js +0 -857
- package/blz-rds-mysql/connection-manager.js +0 -129
- package/blz-rds-mysql/execute-bulk-insert.js +0 -35
- package/blz-rds-mysql/execute-bulk-merge.js +0 -45
- package/blz-rds-mysql/execute-non-query.js +0 -34
- package/blz-rds-mysql/execute-query.js +0 -50
- package/blz-rds-mysql/index.js +0 -41
- package/blz-rds-mysql/stored-procedure.js +0 -207
- package/blz-rds-mysqlx/base.js +0 -846
- package/blz-rds-mysqlx/connection-manager.js +0 -141
- package/blz-rds-mysqlx/execute-bulk-insert.js +0 -35
- package/blz-rds-mysqlx/execute-bulk-merge.js +0 -45
- package/blz-rds-mysqlx/execute-non-query.js +0 -29
- package/blz-rds-mysqlx/execute-query.js +0 -39
- package/blz-rds-mysqlx/index.js +0 -41
- package/blz-rds-mysqlx/stored-procedure.js +0 -179
- package/blz-rds-oracle/index.js +0 -539
- package/blz-rds-postgres/base.js +0 -861
- package/blz-rds-postgres/connection-manager.js +0 -225
- package/blz-rds-postgres/execute-bulk-insert.js +0 -81
- package/blz-rds-postgres/execute-bulk-merge.js +0 -93
- package/blz-rds-postgres/execute-non-query.js +0 -23
- package/blz-rds-postgres/execute-query.js +0 -37
- package/blz-rds-postgres/index.js +0 -41
- package/blz-rds-postgres/result-set.js +0 -51
- package/blz-rds-postgres/stored-procedure.js +0 -116
- package/blz-redis/index.js +0 -217
- package/blz-redis/lib/redisCache.js +0 -265
- package/blz-regex/index.js +0 -25
- package/blz-security/.eslintrc.js +0 -15
- package/blz-security/__test__/AuthorizationKpn.yaml +0 -1149
- package/blz-security/__test__/FinancingSetting.yaml +0 -177
- package/blz-security/__test__/KpnConfigPortal.yaml +0 -330
- package/blz-security/__test__/OrderManagement.yaml +0 -5190
- package/blz-security/__test__/Security.yaml +0 -128
- package/blz-security/__test__/autorization.test.js +0 -105
- package/blz-security/__test__/autorizationKpn.test.js +0 -42
- package/blz-security/__test__/orderManagement.test.js +0 -26
- package/blz-security/__test__/secureUrl.test.js +0 -79
- package/blz-security/__test__/solveMergeRule.test.js +0 -109
- package/blz-security/__test__/sqlInjectionGuard.test.js +0 -203
- package/blz-security/__test__/xssGuard.test.js +0 -204
- package/blz-security/authorizationService.js +0 -537
- package/blz-security/config/global.js +0 -8
- package/blz-security/config/welcome +0 -8
- package/blz-security/doc/README.md +0 -75
- package/blz-security/filescanner/index.js +0 -46
- package/blz-security/helpers/consts.js +0 -229
- package/blz-security/helpers/utils.js +0 -267
- package/blz-security/implementations/cache.js +0 -90
- package/blz-security/implementations/oidc.js +0 -404
- package/blz-security/implementations/pkceCacheStore.js +0 -23
- package/blz-security/implementations/saml.js +0 -10
- package/blz-security/implementations/uma.js +0 -63
- package/blz-security/implementations/webAuthn.js +0 -9
- package/blz-security/implementations/wstg.js +0 -72
- package/blz-security/index.js +0 -77
- package/blz-security/lab/index.js +0 -43
- package/blz-security/middleware/HapiServerAzureAd.js +0 -681
- package/blz-security/middleware/HapiServerKeycloak.js +0 -876
- package/blz-security/middleware/HapiServerSimToken.js +0 -286
- package/blz-security/middleware/hapi.js +0 -555
- package/blz-security/middleware/hapiServer.js +0 -1008
- package/blz-security/navigationMemoryRepository.js +0 -15
- package/blz-security/navigationMongoDbRepository.js +0 -73
- package/blz-security/secureUrlService.js +0 -47
- package/blz-security/securityService.js +0 -413
- package/blz-security/sqlInjectionGuard.js +0 -162
- package/blz-security/templates/forbidden.html +0 -0
- package/blz-security/templates/session-iframe-azure-ad.html +0 -7
- package/blz-security/templates/session-iframe.html +0 -73
- package/blz-security/templates/unauthorized.html +0 -1
- package/blz-security/xssGuard.js +0 -87
- package/blz-strings/index.js +0 -167
- package/blz-uuid/index.js +0 -7
- package/blz-yaml/index.js +0 -19
- package/index.js +0 -84
- package/process-managers/index.js +0 -422
- /package/{blz-rds-mysql → dist/blz-rds-mysql}/syntaxis.json +0 -0
- /package/{blz-rds-mysqlx → dist/blz-rds-mysqlx}/syntaxis.json +0 -0
- /package/{blz-rds-oracle → dist/blz-rds-oracle}/syntaxis.json +0 -0
- /package/{blz-rds-postgres → dist/blz-rds-postgres}/syntaxis.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/ConfigurationAdmin.agent.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/frontend.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/result.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/resultOnWeb.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/rules.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/securityRules.json +0 -0
|
@@ -1,555 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Blazedpath Team
|
|
3
|
-
* @implements Protecting all resources through hapi middleware
|
|
4
|
-
* @description Hapi.js (derived from Http-API) is an open-source Node.js
|
|
5
|
-
* framework used to build powerful and scalable web applications.
|
|
6
|
-
* @see https://hapi.dev/api/
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const Uma = require('../implementations/uma')
|
|
10
|
-
const Jsonwebtoken = require('jsonwebtoken') // Implementations of JSON Web Tokens.
|
|
11
|
-
const {
|
|
12
|
-
Exception,
|
|
13
|
-
getFullUrl,
|
|
14
|
-
getHost,
|
|
15
|
-
getPathname,
|
|
16
|
-
getTemplate,
|
|
17
|
-
getTokenTolerance,
|
|
18
|
-
trace,
|
|
19
|
-
errorResponse
|
|
20
|
-
} = require('../helpers/utils')
|
|
21
|
-
|
|
22
|
-
let contextConfig = {}
|
|
23
|
-
let securityService = null
|
|
24
|
-
|
|
25
|
-
class Hapi {
|
|
26
|
-
constructor (oidc, cookiesName) {
|
|
27
|
-
this.oidc = oidc
|
|
28
|
-
this.COOKIE_NAMES = cookiesName
|
|
29
|
-
this.activateTraceApiMethod = false
|
|
30
|
-
this.queryStringLimit = null;
|
|
31
|
-
this.securityLoginTokenExpToleranceSeconds = 3600 * 5; // Default 5 hours
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async connect (_securityService, context, config) {
|
|
35
|
-
contextConfig = config
|
|
36
|
-
securityService = _securityService
|
|
37
|
-
const { authServer, accessTokenSimulation, activateTraceApiMethod } = config
|
|
38
|
-
if (activateTraceApiMethod) {
|
|
39
|
-
this.activateTraceApiMethod = activateTraceApiMethod
|
|
40
|
-
}
|
|
41
|
-
let oidcConfiguration = {}
|
|
42
|
-
const stateOption = {
|
|
43
|
-
clearInvalid: true,
|
|
44
|
-
encoding: 'base64',
|
|
45
|
-
isSecure: true,
|
|
46
|
-
isHttpOnly: true,
|
|
47
|
-
isSameSite: 'Lax',
|
|
48
|
-
path: '/',
|
|
49
|
-
strictHeader: true
|
|
50
|
-
}
|
|
51
|
-
if (accessTokenSimulation && !authServer) {
|
|
52
|
-
context.config = config
|
|
53
|
-
context.state(this.COOKIE_NAMES.ACCESS_TOKEN, stateOption)
|
|
54
|
-
this.authServerSimulation(context)
|
|
55
|
-
} else {
|
|
56
|
-
try {
|
|
57
|
-
if (authServer.sessionCookiesDomain) {
|
|
58
|
-
stateOption.domain = authServer.sessionCookiesDomain
|
|
59
|
-
}
|
|
60
|
-
const isHttpOnlyForSessionState = authServer.isHttpOnlyForSessionState !== undefined ? authServer.isHttpOnlyForSessionState : false
|
|
61
|
-
context.state(this.COOKIE_NAMES.SID, stateOption)
|
|
62
|
-
stateOption.encoding = 'none'
|
|
63
|
-
stateOption.strictHeader = false
|
|
64
|
-
stateOption.isHttpOnly = isHttpOnlyForSessionState
|
|
65
|
-
context.state(this.COOKIE_NAMES.SESSION_STATE, stateOption)
|
|
66
|
-
oidcConfiguration = await this.configuration(authServer)
|
|
67
|
-
if (!authServer.scope || !authServer.scope.split(' ').some((reg) => reg === 'openid')) {
|
|
68
|
-
authServer.scope = `openid ${authServer.scope || ''}`
|
|
69
|
-
}
|
|
70
|
-
if (authServer.tokenEndpoint && !authServer.tokenEndpoint.match(/https.*/)) {
|
|
71
|
-
context.states.cookies[this.COOKIE_NAMES.SID].isSecure = false
|
|
72
|
-
context.states.cookies[this.COOKIE_NAMES.SESSION_STATE].isSecure = false
|
|
73
|
-
}
|
|
74
|
-
trace('INFO', 'The following configuration was initialized')
|
|
75
|
-
const securityConfiguration = Object.fromEntries(Object.entries(authServer).filter((entry) => !['clientSecret', 'PrivateKey', 'PublicKey'].includes(entry[0])))
|
|
76
|
-
trace('INFO', oidcConfiguration.tokenEndpoint ? oidcConfiguration : securityConfiguration)
|
|
77
|
-
} catch (err) {
|
|
78
|
-
trace('ERROR', `Exception ${err.message}`)
|
|
79
|
-
trace('ERROR', err.stack)
|
|
80
|
-
}
|
|
81
|
-
context.ext('onPreHandler', async (request, h) => {
|
|
82
|
-
const unprotectedPaths = [/\/health/, /\/metrics/]
|
|
83
|
-
const unprotectedExtensions = ['.ico', '.jpg', '.jpeg', '.gif', '.png', '.pdf', '.svg', '.html', '.htm', '.css', '.js', '.js.map', '.json', '.woff', '.woff2']
|
|
84
|
-
const requestUrl = getFullUrl(request)
|
|
85
|
-
if(this.activateTraceApiMethod){
|
|
86
|
-
if(requestUrl.includes('\/api\/')){
|
|
87
|
-
console.log(requestUrl + ' - ' + request.method.toUpperCase());
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
const { session_state: qrSessionState, code } = request.query
|
|
92
|
-
const ckSessionState = request.state[this.COOKIE_NAMES.SESSION_STATE]
|
|
93
|
-
const sid = request.state[this.COOKIE_NAMES.SID]
|
|
94
|
-
const tokenSet = await this.oidc.tokenSet()
|
|
95
|
-
const uma = await Uma.permission()
|
|
96
|
-
const href = h.request.url.href || requestUrl
|
|
97
|
-
|
|
98
|
-
// Check for malicios query string parameters
|
|
99
|
-
if (this.queryStringLimit) {
|
|
100
|
-
const { limit } = request.query; // Access the query parameter "limit"
|
|
101
|
-
// Check if the limit is greater than the configured
|
|
102
|
-
if (limit && parseInt(limit, 10) > this.queryStringLimit) {
|
|
103
|
-
const error = new Error('Bad Request.');
|
|
104
|
-
error.name = 'BadRequest';
|
|
105
|
-
error.code = 400;
|
|
106
|
-
throw error;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if (unprotectedPaths.some((reg) => reg.test(request.path)) || unprotectedExtensions.some((ext) => requestUrl.endsWith(ext))) {
|
|
110
|
-
return h.continue
|
|
111
|
-
}
|
|
112
|
-
if (getHost(request).includes('0.0.0.0') && context.states.cookies[this.COOKIE_NAMES.SID].isSecure) {
|
|
113
|
-
trace('WARN', `Accessing ${getHost(request)} doesn't ensure a secure context for writing cookies.`)
|
|
114
|
-
context.states.cookies[this.COOKIE_NAMES.SID].isSecure = false
|
|
115
|
-
context.states.cookies[this.COOKIE_NAMES.SESSION_STATE].isSecure = false
|
|
116
|
-
}
|
|
117
|
-
trace('INFO', `Navigating to ${requestUrl}`)
|
|
118
|
-
if (!request.state) {
|
|
119
|
-
throw new Exception('Error when getting cookies', 'CookiesError', 404)
|
|
120
|
-
} else if (code && ckSessionState && qrSessionState && qrSessionState !== ckSessionState) {
|
|
121
|
-
trace('ERROR', `The Session cookie ${ckSessionState} doesn't match with the query session ${qrSessionState}`)
|
|
122
|
-
return h
|
|
123
|
-
.response()
|
|
124
|
-
.unstate(this.COOKIE_NAMES.SID)
|
|
125
|
-
.unstate(this.COOKIE_NAMES.SESSION_STATE)
|
|
126
|
-
.redirect(requestUrl)
|
|
127
|
-
.takeover()
|
|
128
|
-
} else if (ckSessionState && sid) {
|
|
129
|
-
// pasa por aca si sid=falsy
|
|
130
|
-
const tokens = await tokenSet.tokens(ckSessionState)
|
|
131
|
-
if (authServer.umaUri) {
|
|
132
|
-
let badUmaUri = false
|
|
133
|
-
const hrefParts = href.split('/')
|
|
134
|
-
if (hrefParts.length > 0) {
|
|
135
|
-
const lastHrefPart = hrefParts[hrefParts.length - 1]
|
|
136
|
-
badUmaUri = lastHrefPart.indexOf('.') !== -1
|
|
137
|
-
}
|
|
138
|
-
if (!badUmaUri) {
|
|
139
|
-
tokens.access_token = await uma.ticket({ tokenUrl: authServer.tokenEndpoint, token: tokens.access_token, audience: authServer.clientId })
|
|
140
|
-
trace('INFO', 'Generating uma ticket:')
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
if (this.validSid(sid)) {
|
|
144
|
-
return h.continue
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
// valid Sid checks for invalid, or expired values.
|
|
148
|
-
const error = new Error('Invalid sid.');
|
|
149
|
-
error.name = 'ExpiredSid';
|
|
150
|
-
error.code = 401;
|
|
151
|
-
throw error;
|
|
152
|
-
}
|
|
153
|
-
} else if (code && sid) {
|
|
154
|
-
trace('INFO', 'Generating token:')
|
|
155
|
-
const tokensSet = await tokenSet.generate({ code, scope: authServer.scope, redirectUri: this.getRedirectUri(request), sid })
|
|
156
|
-
if (!tokensSet) {
|
|
157
|
-
return await this.authenticate(h, authServer.scope)
|
|
158
|
-
}
|
|
159
|
-
trace('INFO', `Set token for session_state:${tokensSet.session_state}`)
|
|
160
|
-
// trace('INFO', tokensSet)
|
|
161
|
-
return h
|
|
162
|
-
.response()
|
|
163
|
-
.state(this.COOKIE_NAMES.SID, sid)
|
|
164
|
-
.state(this.COOKIE_NAMES.SESSION_STATE, tokensSet.session_state)
|
|
165
|
-
.redirect(requestUrl)
|
|
166
|
-
.takeover()
|
|
167
|
-
} else if ((!sid && ckSessionState) || (!ckSessionState && sid)) {
|
|
168
|
-
const error = new Error('Token is Invalid.');
|
|
169
|
-
error.name = 'TokenInvalid';
|
|
170
|
-
error.code = 401;
|
|
171
|
-
throw error;
|
|
172
|
-
} else {
|
|
173
|
-
return await this.authenticate(h, authServer.scope)
|
|
174
|
-
}
|
|
175
|
-
} catch (err) {
|
|
176
|
-
let { code, name, message } = err
|
|
177
|
-
trace('ERROR', `${name}:${message}`)
|
|
178
|
-
code = parseInt(code) || (err.response ? err.response.statusCode : 500)
|
|
179
|
-
const errorList = ['pkce', 'code', 'jwt']
|
|
180
|
-
if (errorList.some((error) => message.includes(error)) && code !== 403) {
|
|
181
|
-
trace('ERROR', `Forbidden ${message}`)
|
|
182
|
-
return h
|
|
183
|
-
.response()
|
|
184
|
-
.unstate(this.COOKIE_NAMES.SID)
|
|
185
|
-
.unstate(this.COOKIE_NAMES.SESSION_STATE)
|
|
186
|
-
.redirect(requestUrl)
|
|
187
|
-
.takeover()
|
|
188
|
-
}
|
|
189
|
-
if (code === 403 || code === 401) {
|
|
190
|
-
if (name === 'ExpirationError' || name === 'TokenInvalid' || (name === 'TokenError' && getPathname(request) === '/')) {
|
|
191
|
-
return h
|
|
192
|
-
.response()
|
|
193
|
-
.unstate(this.COOKIE_NAMES.SID)
|
|
194
|
-
.unstate(this.COOKIE_NAMES.SESSION_STATE)
|
|
195
|
-
.redirect('/logout')
|
|
196
|
-
.takeover()
|
|
197
|
-
} else if (name === 'ExpiredSid') {
|
|
198
|
-
return h
|
|
199
|
-
.response()
|
|
200
|
-
.unstate(this.COOKIE_NAMES.SID)
|
|
201
|
-
.unstate(this.COOKIE_NAMES.SESSION_STATE)
|
|
202
|
-
.code(401)
|
|
203
|
-
.redirect('/logout')
|
|
204
|
-
.takeover()
|
|
205
|
-
} else {
|
|
206
|
-
return h
|
|
207
|
-
.response()
|
|
208
|
-
.code(401)
|
|
209
|
-
.unstate(this.COOKIE_NAMES.SID)
|
|
210
|
-
.unstate(this.COOKIE_NAMES.SESSION_STATE)
|
|
211
|
-
.takeover()
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return h
|
|
215
|
-
.response({ name, message })
|
|
216
|
-
.code(code || 500)
|
|
217
|
-
.unstate(this.COOKIE_NAMES.SID)
|
|
218
|
-
.unstate(this.COOKIE_NAMES.SESSION_STATE)
|
|
219
|
-
.takeover()
|
|
220
|
-
}
|
|
221
|
-
})
|
|
222
|
-
const me = this
|
|
223
|
-
context.route({
|
|
224
|
-
method: 'GET',
|
|
225
|
-
path: '/get-authorization',
|
|
226
|
-
handler: async (request, h) => {
|
|
227
|
-
try {
|
|
228
|
-
const { session_state: ckSessionState } = request.state
|
|
229
|
-
if (!ckSessionState) {
|
|
230
|
-
throw new Exception("old Hapi get-authorization: Session cookie doesn't exist.", 'CookiesError', 404)
|
|
231
|
-
}
|
|
232
|
-
const tokenSet = await me.oidc.tokenSet()
|
|
233
|
-
const tokens = await tokenSet.tokens(ckSessionState)
|
|
234
|
-
const uma = await Uma.permission()
|
|
235
|
-
const token = await uma.ticket({ tokenUrl: authServer.tokenEndpoint || authServer.tokenUrl, token: tokens.access_token, audience: authServer.clientId })
|
|
236
|
-
const sourceData = Jsonwebtoken.decode(token.access_token)
|
|
237
|
-
return h.response(JSON.stringify(sourceData.authorization)).takeover()
|
|
238
|
-
} catch (err) {
|
|
239
|
-
return errorResponse(h, err, 401)
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
context.route({
|
|
245
|
-
method: 'GET',
|
|
246
|
-
path: '/get-security-rules',
|
|
247
|
-
handler: async (request, h) => {
|
|
248
|
-
try {
|
|
249
|
-
const securityRules = await securityService.getFrontendSecurityRules(request)
|
|
250
|
-
return h.response(JSON.stringify(securityRules)).takeover()
|
|
251
|
-
} catch (err) {
|
|
252
|
-
return errorResponse(h, err, 401)
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
context.route({
|
|
258
|
-
method: 'GET',
|
|
259
|
-
path: '/get-permissions',
|
|
260
|
-
handler: async (request, h) => {
|
|
261
|
-
try {
|
|
262
|
-
const permissions = await securityService.getPermissions()
|
|
263
|
-
return h.response(JSON.stringify(permissions)).takeover()
|
|
264
|
-
} catch (err) {
|
|
265
|
-
return errorResponse(h, err, 401)
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
context.route({
|
|
271
|
-
method: 'GET',
|
|
272
|
-
path: '/check-authorize',
|
|
273
|
-
handler: async (request, h) => {
|
|
274
|
-
try {
|
|
275
|
-
const resourcePath = request.query.path;
|
|
276
|
-
const action = request.query.action;
|
|
277
|
-
const roles = request.query.roles;
|
|
278
|
-
const domains = request.query.domains;
|
|
279
|
-
let parsedRoles;
|
|
280
|
-
if (Array.isArray(roles)) {
|
|
281
|
-
parsedRoles = roles;
|
|
282
|
-
} else if (typeof roles === 'string') {
|
|
283
|
-
parsedRoles = roles.split(',').map(r => r.trim());
|
|
284
|
-
} else {
|
|
285
|
-
parsedRoles = [];
|
|
286
|
-
}
|
|
287
|
-
let parsedDomains;
|
|
288
|
-
if (Array.isArray(domains)) {
|
|
289
|
-
parsedDomains = domains;
|
|
290
|
-
} else if (typeof domains === 'string') {
|
|
291
|
-
parsedDomains = domains.split(',').map(d => d.trim());
|
|
292
|
-
} else {
|
|
293
|
-
parsedDomains = [];
|
|
294
|
-
}
|
|
295
|
-
const result = await securityService.checkAuthorize(
|
|
296
|
-
resourcePath,
|
|
297
|
-
action,
|
|
298
|
-
parsedRoles,
|
|
299
|
-
parsedDomains
|
|
300
|
-
);
|
|
301
|
-
return h.response(JSON.stringify(result)).takeover()
|
|
302
|
-
} catch (err) {
|
|
303
|
-
return errorResponse(h, err, 401)
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
})
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
context.route({
|
|
311
|
-
method: 'GET',
|
|
312
|
-
path: '/get-user-info',
|
|
313
|
-
handler: async (request, h) => {
|
|
314
|
-
try {
|
|
315
|
-
const userInfo = await securityService.getUserInfo(request)
|
|
316
|
-
return h
|
|
317
|
-
.response(JSON.stringify(userInfo))
|
|
318
|
-
.takeover()
|
|
319
|
-
} catch (err) {
|
|
320
|
-
return errorResponse(h, err, 500)
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
})
|
|
324
|
-
context.route({
|
|
325
|
-
path: '/logout',
|
|
326
|
-
method: 'GET',
|
|
327
|
-
handler: async (request, h) => {
|
|
328
|
-
try {
|
|
329
|
-
const ckSessionState = request.state[this.COOKIE_NAMES.SESSION_STATE]
|
|
330
|
-
return h
|
|
331
|
-
.response()
|
|
332
|
-
.unstate(this.COOKIE_NAMES.SID)
|
|
333
|
-
.unstate(this.COOKIE_NAMES.SESSION_STATE)
|
|
334
|
-
.redirect(await me.oidc.endSessionUrl({
|
|
335
|
-
sessionState: ckSessionState,
|
|
336
|
-
redirectUri: this.getRedirectUri(request)
|
|
337
|
-
}))
|
|
338
|
-
.takeover()
|
|
339
|
-
} catch (err) {
|
|
340
|
-
return errorResponse(h, err, 500)
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
})
|
|
344
|
-
context.route({
|
|
345
|
-
path: '/invalid-session',
|
|
346
|
-
method: 'GET',
|
|
347
|
-
handler: async (request, h) => {
|
|
348
|
-
try {
|
|
349
|
-
const endSessionUrl = await me.oidc.endSessionUrl({
|
|
350
|
-
redirectUri: this.getRedirectUri(request),
|
|
351
|
-
sessionState: request.state[this.COOKIE_NAMES.SESSION_STATE]
|
|
352
|
-
})
|
|
353
|
-
return h
|
|
354
|
-
.response()
|
|
355
|
-
.unstate(this.COOKIE_NAMES.SID)
|
|
356
|
-
.unstate(this.COOKIE_NAMES.SESSION_STATE)
|
|
357
|
-
.redirect(endSessionUrl)
|
|
358
|
-
.takeover()
|
|
359
|
-
} catch (err) {
|
|
360
|
-
return errorResponse(h, err, 500)
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
})
|
|
364
|
-
|
|
365
|
-
context.route({
|
|
366
|
-
path: '/check-session-iframe.html',
|
|
367
|
-
method: 'GET',
|
|
368
|
-
handler: async (_request, h) => {
|
|
369
|
-
try {
|
|
370
|
-
let content = '<html/>'
|
|
371
|
-
if (authServer && authServer.checkSessionIframe) {
|
|
372
|
-
const { checkSessionIframe: sessionIframeUrl, clientId, sessionCookiesPrefix } = authServer
|
|
373
|
-
if (sessionIframeUrl && sessionIframeUrl.includes('https://')) {
|
|
374
|
-
trace('INFO', `Session management url: ${sessionIframeUrl}`)
|
|
375
|
-
content = getTemplate('session-iframe', {
|
|
376
|
-
sessionIframeUrl,
|
|
377
|
-
clientId,
|
|
378
|
-
sessionCookiesPrefix: sessionCookiesPrefix || ''
|
|
379
|
-
})
|
|
380
|
-
} else {
|
|
381
|
-
trace('WARN', 'For session management, it is necessary to get the value from a cookie called session_state, and as a good practice, it should have reached a secure context [TLS].')
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return h
|
|
385
|
-
.response(content)
|
|
386
|
-
.header('Content-Type', 'text/html')
|
|
387
|
-
} catch (err) {
|
|
388
|
-
return errorResponse(h, err, 500)
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
})
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
validSid(sid){
|
|
395
|
-
let decodedSid = Jsonwebtoken.decode(sid);
|
|
396
|
-
if (!decodedSid) {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
// checks for expiration against current time, with 5' tolerance
|
|
400
|
-
if (decodedSid.exp)
|
|
401
|
-
return (decodedSid.exp + this.securityLoginTokenExpToleranceSeconds > (Date.now() / 1000))
|
|
402
|
-
else
|
|
403
|
-
return false;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
authServerSimulation (context) {
|
|
407
|
-
if (!context.config || !context.config.accessTokenSimulation) {
|
|
408
|
-
throw new Exception('Error parsing metadata for simulation', 'ConfigurationError', 404)
|
|
409
|
-
}
|
|
410
|
-
let { algorithm, payload, secret } = context.config.accessTokenSimulation
|
|
411
|
-
const me = this
|
|
412
|
-
context.ext('onPreAuth', async function (request, h) {
|
|
413
|
-
if (request.state && request.state[me.COOKIE_NAMES.ACCESS_TOKEN]) {
|
|
414
|
-
return h.continue
|
|
415
|
-
} else {
|
|
416
|
-
switch (algorithm) {
|
|
417
|
-
case 'HMAC-SHA384': {
|
|
418
|
-
algorithm = 'HS384'
|
|
419
|
-
break
|
|
420
|
-
}
|
|
421
|
-
case 'HMAC-SHA512': {
|
|
422
|
-
algorithm = 'HS512'
|
|
423
|
-
break
|
|
424
|
-
}
|
|
425
|
-
default: {
|
|
426
|
-
algorithm = 'HS256'
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
const jwt = me.oidc.jwt().sign({ payload, secret, algorithm })
|
|
430
|
-
return h
|
|
431
|
-
.response()
|
|
432
|
-
.state(me.COOKIE_NAMES.ACCESS_TOKEN, jwt)
|
|
433
|
-
.redirect(me.getRedirectUri(request))
|
|
434
|
-
.takeover()
|
|
435
|
-
}
|
|
436
|
-
})
|
|
437
|
-
context.route({
|
|
438
|
-
path: '/get-authorization',
|
|
439
|
-
method: 'GET',
|
|
440
|
-
handler: async function (_request, h) {
|
|
441
|
-
return h
|
|
442
|
-
.response('[]')
|
|
443
|
-
.code(200)
|
|
444
|
-
}
|
|
445
|
-
})
|
|
446
|
-
context.route({
|
|
447
|
-
path: '/get-security-rules',
|
|
448
|
-
method: 'GET',
|
|
449
|
-
handler: async function (_request, h) {
|
|
450
|
-
let securityRules = []
|
|
451
|
-
if (securityService && context.config.accessTokenSimulation.playload) {
|
|
452
|
-
const groups = securityService.getGroups(context.config.accessTokenSimulation.playload)
|
|
453
|
-
securityRules = securityService.getFrontendSecurityRules([groups])
|
|
454
|
-
}
|
|
455
|
-
return h
|
|
456
|
-
.response(JSON.stringify(securityRules))
|
|
457
|
-
.code(200)
|
|
458
|
-
}
|
|
459
|
-
})
|
|
460
|
-
context.route({
|
|
461
|
-
path: '/get-permissions',
|
|
462
|
-
method: 'GET',
|
|
463
|
-
handler: async function (_request, h) {
|
|
464
|
-
const permissions = (securityService) ? securityService.getPermissions() : []
|
|
465
|
-
return h
|
|
466
|
-
.response(JSON.stringify(permissions))
|
|
467
|
-
.code(200)
|
|
468
|
-
}
|
|
469
|
-
})
|
|
470
|
-
context.route({
|
|
471
|
-
path: '/get-user-info',
|
|
472
|
-
method: 'GET',
|
|
473
|
-
handler: async function (_request, h) {
|
|
474
|
-
return h
|
|
475
|
-
.response(JSON.stringify(payload))
|
|
476
|
-
.code(200)
|
|
477
|
-
}
|
|
478
|
-
})
|
|
479
|
-
context.route({
|
|
480
|
-
path: '/logout',
|
|
481
|
-
method: 'GET',
|
|
482
|
-
handler: async function (_request, h) {
|
|
483
|
-
return h
|
|
484
|
-
.response()
|
|
485
|
-
.unstate(this.COOKIE_NAMES.ACCESS_TOKEN)
|
|
486
|
-
.takeover()
|
|
487
|
-
}
|
|
488
|
-
})
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
getRedirectUri (request) {
|
|
492
|
-
return contextConfig.authServer.redirectUri || getFullUrl(request)
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
async authenticate (h, scope) {
|
|
496
|
-
const { request } = h
|
|
497
|
-
const pkceCode = await this.oidc.pkceCode()
|
|
498
|
-
const requestUrl = getFullUrl(request)
|
|
499
|
-
let oidcMetadata = await this.oidc.oidcMetadata()
|
|
500
|
-
if (!oidcMetadata || !oidcMetadata.openid_configuration) {
|
|
501
|
-
oidcMetadata = await this.configuration(contextConfig.authServer)
|
|
502
|
-
}
|
|
503
|
-
if (requestUrl.match(new RegExp(/^(https?:\/{2}.*):?(\d*)/.source + getHost(request) + /\/?$/.source))) {
|
|
504
|
-
const authorizationUrl = await this.oidc.authorizationUrl({ scope, redirectUri: this.getRedirectUri(request), pkceCode })
|
|
505
|
-
trace('INFO', `Authenticate redirecting to ${authorizationUrl}`)
|
|
506
|
-
return h
|
|
507
|
-
.response()
|
|
508
|
-
.state(this.COOKIE_NAMES.SID, pkceCode)
|
|
509
|
-
.redirect(authorizationUrl)
|
|
510
|
-
.takeover()
|
|
511
|
-
} else if (getPathname(request) === '/logout') {
|
|
512
|
-
return h.continue
|
|
513
|
-
} else {
|
|
514
|
-
const tokenSet = await this.oidc.tokenSet()
|
|
515
|
-
const { state } = request
|
|
516
|
-
if (tokenSet && state && state[this.COOKIE_NAMES.SESSION_STATE]) {
|
|
517
|
-
const tokens = await tokenSet.tokens(state[this.COOKIE_NAMES.SESSION_STATE])
|
|
518
|
-
if (!tokens || tokens.refresh_expires_in <= getTokenTolerance(0)) {
|
|
519
|
-
throw new Exception('Error when getting token', 'ExpirationError', 403)
|
|
520
|
-
}
|
|
521
|
-
return h.continue
|
|
522
|
-
} else {
|
|
523
|
-
return h
|
|
524
|
-
.response()
|
|
525
|
-
.code(401)
|
|
526
|
-
.takeover()
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
async configuration (authServer) {
|
|
532
|
-
if (!authServer) {
|
|
533
|
-
throw new Exception('Error when getting configuration attributes ')
|
|
534
|
-
}
|
|
535
|
-
const { clientId, clientSecret } = authServer
|
|
536
|
-
await this.oidc.client({ clientId, clientSecret })
|
|
537
|
-
if (authServer.openIdConfigurationEndpoint) {
|
|
538
|
-
return await this.oidc.configuration(authServer.openIdConfigurationEndpoint)
|
|
539
|
-
} else {
|
|
540
|
-
// If configuration uri does not exist but the auth server form has been filled in.
|
|
541
|
-
return await this.oidc.configuration({
|
|
542
|
-
issuer: authServer.issuer,
|
|
543
|
-
authorization_endpoint: authServer.authorizationEndpoint,
|
|
544
|
-
token_endpoint: authServer.tokenEndpoint,
|
|
545
|
-
userinfo_endpoint: authServer.userinfoEndpoint,
|
|
546
|
-
end_session_endpoint: authServer.endSessionEndpoint,
|
|
547
|
-
jwks_uri: authServer.jwksUri
|
|
548
|
-
})
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
module.exports = {
|
|
554
|
-
Hapi
|
|
555
|
-
}
|