Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
assert(endpoint instanceof EndpointDescription);
const endpoint_securityPolicy = fromURI(endpoint.securityPolicyUri);
if (endpointUrl && endpoint.endpointUrl! !== endpointUrl) {
return false;
}
return (endpoint.securityMode === securityMode && endpoint_securityPolicy === securityPolicy);
}
const defaultSecurityModes = [
MessageSecurityMode.None,
MessageSecurityMode.Sign,
MessageSecurityMode.SignAndEncrypt
];
const defaultSecurityPolicies = [
SecurityPolicy.Basic128Rsa15,
SecurityPolicy.Basic256,
// xx UNUSED!! SecurityPolicy.Basic256Rsa15,
SecurityPolicy.Basic256Sha256
];
assert(endpoint instanceof EndpointDescription);
const endpoint_securityPolicy = fromURI(endpoint.securityPolicyUri);
if (endpointUrl && endpoint.endpointUrl! !== endpointUrl) {
return false;
}
return (endpoint.securityMode === securityMode && endpoint_securityPolicy === securityPolicy);
}
const defaultSecurityModes = [
MessageSecurityMode.None,
MessageSecurityMode.Sign,
MessageSecurityMode.SignAndEncrypt
];
const defaultSecurityPolicies = [
SecurityPolicy.Basic128Rsa15,
SecurityPolicy.Basic256,
// xx UNUSED!! SecurityPolicy.Basic256Rsa15,
SecurityPolicy.Basic256Sha256
];
userIdentityTokens.push({
policyId: "certificate_basic256",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256
});
userIdentityTokens.push({
policyId: "certificate_basic128",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic128Rsa15
});
userIdentityTokens.push({
policyId: "certificate_basic256Sha256",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256Sha256
});
userIdentityTokens.push({
policyId: "certificate_basic256Sha256",
tokenType: UserTokenType.Certificate,
issuedTokenType: null,
function securityPolicyLevel(securityPolicy: UAString): number {
switch (securityPolicy) {
case SecurityPolicy.None:
return 0;
case SecurityPolicy.Basic128:
return 0;
case SecurityPolicy.Basic128Rsa15:
return 0;
case SecurityPolicy.Basic192:
return 1;
case SecurityPolicy.Basic192Rsa15:
return 2;
case SecurityPolicy.Basic256:
return 3;
case SecurityPolicy.Basic256Rsa15:
return 3;
case SecurityPolicy.Basic256Sha256:
return 3;
default:
return 0;
}
}
userIdentityTokens.push({
policyId: "certificate_basic256",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256
});
userIdentityTokens.push({
policyId: "certificate_basic128",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic128Rsa15
});
userIdentityTokens.push({
policyId: "certificate_basic256Sha256",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256Sha256
});
userIdentityTokens.push({
policyId: "certificate_basic256Sha256",
tokenType: UserTokenType.Certificate,
issuedTokenType: null,
function securityPolicyLevel(securityPolicy) {
switch (securityPolicy) {
case SecurityPolicy.None:
return 0;
case SecurityPolicy.Basic128:
return 0;
case SecurityPolicy.Basic128Rsa15:
return 0;
case SecurityPolicy.Basic192:
return 1;
case SecurityPolicy.Basic192Rsa15:
return 2;
case SecurityPolicy.Basic256:
return 3;
case SecurityPolicy.Basic256Rsa15:
return 3;
case SecurityPolicy.Basic256Sha256:
return 3;
default:
return 0;
}
}