Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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: "username_basic256Sha256",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256Sha256
});
userIdentityTokens.push({
policyId: "certificate_basic256Sha256",
tokenType: UserTokenType.Certificate,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256Sha256
});
// X509
userIdentityTokens.push({
policyId: "certificate_basic256",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256
});
userIdentityTokens.push({
policyId: "certificate_basic128",
tokenType: UserTokenType.UserName,
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_basic256Sha256",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256Sha256
});
userIdentityTokens.push({
policyId: "certificate_basic256Sha256",
tokenType: UserTokenType.Certificate,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256Sha256
});
} else {
// note:
// when channel session security is not "None",
// userIdentityTokens can be left to null.
// in this case this mean that secure policy will be the same as connection security policy
userIdentityTokens.push({
policyId: "usernamePassword",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: null
});
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,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256Sha256
});
} else {
// note:
// when channel session security is not "None",
// userIdentityTokens can be left to null.
// in this case this mean that secure policy will be the same as connection security policy
userIdentityTokens.push({
policyId: "usernamePassword",
tokenType: UserTokenType.UserName,
issuedTokenType: null,
issuerEndpointUrl: null,
securityPolicyUri: null
});
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,
issuerEndpointUrl: null,
securityPolicyUri: SecurityPolicy.Basic256Sha256
});
} else {
// note:
// when channel session security is not "None",
// userIdentityTokens can be left to null.
// in this case this mean that secure policy will be the same as connection security policy
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;
}
}
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;
}
}