Commit f309e9e5 authored by Pavel Mashliakovskiy's avatar Pavel Mashliakovskiy 🤹🏻

- expose CryptoJS in ub-pub

- add CryptoJS.enc.Base64
- use CryptoJS.enc.Base64 instead of window.btoa to encode a password for UBLDAP - this allows non-english characters in password
parent 9d9a9273
Pipeline #21790 skipped with stage
......@@ -522,7 +522,8 @@ $App.connection.userLang()
pwdForAuth = MD5(pwdHash).toString()
secretWord = pwdForAuth // medium unsecured
} else {
pwdForAuth = window.btoa(authParams.password)
// window.btoa(authParams.password) fails on non Latin1 chars
pwdForAuth = CryptoJSCore.enc.Base64.stringify(CryptoJSCore.enc.Utf8.parse(authParams.password))
secretWord = pwdForAuth // unsecured - to be used only with HTTPS!!
}
} else {
......
......@@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- `ub-pub` now exports a `CryptoJS` instance (included modules are enc-base64, sha256, md5)
- `enc-base64` module added to CryptoJS instance. Available as `UB.CryptoJS.enc.Base64`.
### Changed
......@@ -14,6 +16,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed
### Fixed
- allows to encode a non-english passwords for UBLDAP auth by using `base64` from CryptoJS instead of `btoa` in AsyncConnection.
This fix error "String contains an invalid character" in case password contains non-english letters. From a server side
UTF8 LDAP password support is added in UB@5.18.10
## [5.5.17] - 2020-07-26
### Fixed
......
......@@ -13,6 +13,7 @@ const CryptoJS = require('@unitybase/cryptojs')
// const CryptoJSCore = require('@unitybase/cryptojs/core')
const SHA256 = require('@unitybase/cryptojs/sha256')
const MD5 = require('@unitybase/cryptojs/md5')
const BASE64Encl = require('@unitybase/cryptojs/enc-base64')
const UBNativeMessage = require('./UBNativeMessage')
let _errorReporter = null
......@@ -452,6 +453,10 @@ Promise.all([UB.inject('css/first.css'), UB.inject('css/second.css')])
*/
inject: function (url, charset) { return injection.inject(url, charset) },
addResourceVersion: injection.addResourceVersion,
/**
* CryptoJS instance (included modules are enc-base64, sha256, md5)
*/
CryptoJS: CryptoJS,
/**
* Calculate SHA256 checksum
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment