MXToolbox - http://mxtoolbox.com
Binary Search Tree
10 years ago
internal static ClaimsIdentityCollection RequestTokenWithUsernameMixed()
{
var binding = new WS2007HttpBinding(SecurityMode.TransportWithMessageCredential, false);
binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
binding.Security.Message.EstablishSecurityContext = false;
var credentials = new ClientCredentials();
credentials.UserName.UserName = "Mary";
credentials.UserName.Password = "Passw0rd!";
var endpoint = "https://mygenevaserver/Trust/13/UsernameMixed";
var client = new WSTrustClient(binding, new EndpointAddress(new Uri(endpoint)), TrustVersion.WSTrust13, credentials);
var request = new RequestSecurityToken();
request.RequestType = "http://schemas.microsoft.com/idfx/requesttype/issue";
request.AppliesTo = new EndpointAddress("http://localhost/activerp");
var token = client.Issue(request) as GenericXmlSecurityToken;
var claims = token.ToClaimsIdentityCollection(TrustVersion.WSTrust13, CertificateUtility.GetCertificate(StoreName.My, StoreLocation.LocalMachine, "CN=Geneva Signing Certificate - WIN-66EYOLL2BVY"), CertificateUtility.GetCertificate(StoreName.My, StoreLocation.LocalMachine, "CN=WMSvc-WIN-66EYOLL2BVY"));
return claims;
}
Here is another one using the WindowsMixed endpoint (notice the MessageCredentialType.Windows and no username and password set)internal static ClaimsIdentityCollection RequestTokenWithWindowsMixed()
{
var binding = new WS2007HttpBinding(SecurityMode.TransportWithMessageCredential, false);
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
binding.Security.Message.EstablishSecurityContext = false;
var credentials = new ClientCredentials();
var endpoint = "https://mygenevaser/Trust/13/WindowsMixed";
var client = new WSTrustClient(binding, new EndpointAddress(new Uri(endpoint)), TrustVersion.WSTrust13, credentials);
var request = new RequestSecurityToken();
request.RequestType = "http://schemas.microsoft.com/idfx/requesttype/issue";
request.AppliesTo = new EndpointAddress("http://localhost/activerp");
var token = client.Issue(request) as GenericXmlSecurityToken;
var claims = token.ToClaimsIdentityCollection(TrustVersion.WSTrust13, CertificateUtility.GetCertificate(StoreName.My, StoreLocation.LocalMachine, "CN=Geneva Signing Certificate - WIN-66EYOLL2BVY"), CertificateUtility.GetCertificate(StoreName.My, StoreLocation.LocalMachine, "CN=WMSvc-WIN-66EYOLL2BVY"));
return claims;
}
You can use this together with the CreateChannelWithIssuedToken extension methodNote: there is now a 64 bit version of DirSync so it should be possible to install that on the DC as well.
New-MsolUser -UserPrincipalName john@litwareinc.com -DisplayName "John Doe" -FirstName "John" -LastName "Doe"
Set-MsolUserLicense -UserPrincipalName user@litwareinc.onmicrosoft.com -AddLicenses "litwareinc: ENTERPRISEPACK" -RemoveLicenses "litwareinc:SHAREPOINTSTANDARD"
Remove-MsolUser -UserPrincipalName john@litwareinc.onmicrosoft.com
Set-MsolUserPassword -userPrincipalName john@litwareind.onmicrosoft.com
-NewPassword "password" -ForceChangePassword $false
Set-MsolUser -UserPrincipalName user@ litwareinc.onmicrosoft.com -blockcredential $true
Set-MsolUser -UserPrincipalName user@ litwareinc.onmicrosoft.com
-PasswordNeverExpires $true
Set-MsolUser -UserPrincipalName user@litwareinc.onmicrosoft.com
-StrongPasswordRequired $true
$salesGroup = Get-MsolGroup | where-object { $_.DisplayName -eq "Sales Executives"}
$user = Get-MsolUser | where-object { $_.DisplayName -eq "Phil" }
Add-MsolGroupMember -GroupObjectId $salesGroup.ObjectId -GroupMemberType "User"
-GroupMemberObjectId $user.ObjectId