w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Using Active Directory to login using a local user
This is all that the Websecurity.Login method does: public static bool Login(string userName, string password, bool persistCookie = false) { WebSecurity.VerifyProvider(); bool flag = Membership.ValidateUser(userName, password); if (flag) { FormsAuthentication.SetAuthCookie(userName, persistCookie); } return flag; } You can write your own method that authenticates against AD and then looks up the user name and the does sets the auth cookie something like: public static bool MyLogin(string userName, string password, bool persistCookie = false) { bool flag = CheckADUser(userName, password); if (flag) { string mappedUsername = GetMappedUser(userName); if(mappedUsername != "") { FormsAuthentication.SetAuthCooki

Categories : C#

Determine User Active Directory Groups from Local Machine off Network
From the top: My current project requires that I validate a user against Active Directory groups. The catch is, the computer may not always be connected to the domain but users may still need to run the tool. At this point, you must therefore accept that any enforced security is able to be bypassed by an attacker since it is entirely enforced on the client. Not exactly part of the solution, but keep it in mind. I understand that I can't query Active Directory while I'm not connected, instead I'm trying to query the Machine SAM (MSAM). The Security Accounts Manager only stores the local accounts (MACHINENAMEAdministrator and others). It will not have domain user credentials. You are thinking of the LSA cache, which remembers the last N domain logins's credentials (where

Categories : C#

How can a user be kept from creating and using multiple accounts?
See my answers here and here. They don't refer to any specific publications, which I would be surprised to see, because of so different reasons why addressing this problem in first place (see these links for more discussion on that) and that post about being user-friendly.

Categories : Misc

Django allauth - Multiple social accounts with a custom user
Adding/connection additional accounts is documented here: http://django-allauth.readthedocs.org/en/latest/templates.html#social-account-tags Specifically, see the process parameter. Example: <a href="{% provider_login_url "twitter" process="connect" %}">Connect a Twitter account</a>

Categories : Misc

Active Directory authentication through ssl as anonymous user
I did some research and found other applications having similar issues. 1. Make sure you have imported your certificates into the keystore according to the Connect to LDAP or Other Services Via SSL instructions. 2. Make sure any certificates have been imported into the correct keystore; you may have multiple JDKs.

Categories : Java

How to get user Data from LDAP Active directory?
I got the solution: - I have change my filter variable and it starts working ..:) Here is my class and methods used: class LdapDataReciver: def get_access_token(self,data): user_detail = {'user_name':data} auth = HMAAuthentication(expire_duration=4*60*60) access_token = auth.create_access_token(user_detail) return access_token def get_group(self,list): groups=[] try: for entry in list: cn = entry.split(' ') cn1 = cn[0].split('=') groups.append(cn1[1]) return groups; except : raise AuthenticationException("userName does not exist") def authenticate_with_active_directory(self,username,password): try: l = ldap.initialize(settings.LDAP_URL) l.simple_bind(username, password)

Categories : Django

Searching User In Active Directory By Full Name
Change "... name='" & var5 & "'" to either "... displayName='" & var5 & "'" or "... sn='" & lastname & "' and givenName='" & firstname & "'" For the latter you need 2 variables: one with the first and the other with the last name.

Categories : Search

Using Active Directory/LDAP to Login user in ASP.NET 3.5 app
You can go over the PrincipalContext Like this: using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, myDomainTextBox.Text)) { // validate the credentials bool cIsValid = pc.ValidateCredentials(myUserNameTextBox.Text, myPasswordBox.Password); if (cIsValid) { // Do some stuff } }

Categories : C#

c# Active Directory Authentication User if Computer not in domain
I've tried this one. The computer now i'm using is not in domain. try { DirectoryContext context = new DirectoryContext(DirectoryContextType.DirectoryServer, "IP", "Username", "Password"); DirectoryEntry deDoc = Domain.GetDomain(context).GetDirectoryEntry(); } catch (Exception ex) { MessageBox.Show(ex.Message); }

Categories : C#

retrieve and display user image from active directory with c#
You should add an img tag with a src url to your handler you wrote (which should arguably be a HttpHandler for Web Forms) I'd imagine the url would look like <img src="http://myintranetsite/ADImageHandler alt="" />

Categories : C#

How to return user details from the Active Directory using PrincipalContext
I don't understand why you are mixing the new PrincipalContext with the old DirectoryEntry stuff. Doesn't make any sense..... Also - you're searching for all users, but in the end, you're returning only a single DirectoryEntry - why?!? If you're using the new PrincipalContext - then use the UserPrincipal - it contains nice and easy to use properties about the user - much easier to use and work with than the old DirectoryEntry stuf.... public List<UserPrincipal> GetAllUsersDetails() { using (var context = new PrincipalContext(ContextType.Domain, "WIN-SPDEV.com")) using (var searcher = new PrincipalSearcher(new UserPrincipal(context))) { var searchResults = searcher.FindAll(); List<UserPrincipal> results = new List<UserPrincipal>();

Categories : Asp Net

Active Directory LDAP move user to different OU - Ruby
This is how we solved it: @ldap.rename(olddn: user.dn, newrdn: "CN=#{user.cn}", delete_attributes: true, new_superior: "#{new_ou}") We also used the version of ldap-ruby on Github not the version on RubyGems.

Categories : Ruby

Get active directory user group property in asp.net website - web.config
'I don't know if you can get this information by a web.config setting, but you can get this information from the System.DirectoryServices.AccountManagement namespace. (if you're looking per user) You could store the domain name in the appsettings of the web.config and do something like... private static PrincipalContext _ctx = new PrincipalContext(ContextType.Domain, System.Configuration.ConfigurationManager.AppSettings["DomainName"]); public List<string> UserGroups(string userName) { List<string> ret = new List<string>(); using (UserPrincipal user = UserPrincipal.FindByIdentity(_ctx, userName)) { if (user != null) { foreach (Principal p in user.GetAuthorizationGroups()) { ret.Add(p.Name); } } }

Categories : C#

I need a script to detect if a computer is in an active directory user group
You could try something like this in PowerShell to check that the named computer is in the OU or not: Script: import-module activedirectory $OU = @() $CheckOU = "LaptopOU" $computerName = "Laptop12345" $user = get-adcomputer $computerName -Properties * $user.DistinguishedName -split "," | %{If($_ -match "OU="){$OU += $_ -replace "OU=",""}} If($OU -match $CheckOU){ "Computer:$computerName is in the OU:$CheckOU" # Do something... } Else{ "Computer:$computerName is not in the OU:$CheckOU" # Do something else.. } This will take a $computerName and get all the OU's that it's in from Active Directory and stores them in an $OU array. Then you can use that array to simply check if the computer is in the given OU ($CheckOU) or not by using the -match operator. Note: You

Categories : Powershell

To retrieve logged in user's Active directory data from Websphere
Logged on user is represented as a set of principals within JAAS subject. Information like user name or email is not present there and is not supposed to. You have no other option other than query LDAP (Active Directory in your case). The statement like "i have already connected to active directory" does not make much sense. Yes, the user is authenticated by WAS through AD, but this does not mean that any sort of persistent connection exists.

Categories : Java

Query Active Directory in Java using a logged on user on windows
I'm going off of this guy's post. You can go with the commercial Jespa library, which uses NTLMv2. Or you can go with the open source com4j project that uses ADSI, created by Kohsuke Kawaguchi.

Categories : Java

I want to add a random generated password to my newly created Active Directory User
This is written so that $sourceData can be a string like the following. If you really want to pass $sourcedata as an array of char remove the [char[]] cast from the function. $sourcedata="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-$" Function GET-Temppassword() { Param( [int]$length=10, [string[]]$sourcedata ) -join ([char[]] $sourcedata | GET-RANDOM -count $length) } get-temppassword $sourceData 20 GVTXxF13ibnBK5AQOu-P

Categories : Powershell

How do I create a batch script that creates a task for a specific user in the Active Directory?
For it to run as that user you need to specify both username and password. schtasks.exe /create /? [snip] /U username Specifies the user context under which the command should execute. /P password Specifies the password for the given user context. [snip] So, for user 'jsmith', with password 'password1', your command will end up looking something like: schtasks.exe /create /u jsmith /p password1 /sc once /tn defrag /tr "\compnameC$Windowssystem32defrag.exe c:" /st 14:33:00

Categories : Windows

How to link multiple accounts together for Meteor accounts?
This looks like a solution for this (not straightforward): http://ondrej-kvasnovsky.blogspot.com/2013/07/meteor-how-to-login-with-github-account.html

Categories : Meteor

Authenticate user against active directory using MVC4 forms with optional input domainusername or just username
You could try to use double authentication solution using both Membership and PrincipalContext public bool ActiveDirectoryAuthentication(string username, string password) { var splittedCredentials = username.Split(new[] { "\" }, StringSplitOptions.None); switch (splittedCredentials.Length) { case 1: { var authenticated = Membership.ValidateUser(username, password); if (authenticated) { FormsAuthentication.SetAuthCookie(username, false); } return authenticated; } case 2: { var principalContext = new PrincipalContext(ContextType.Domain, splittedCreden

Categories : C#

FTP multiple files using apache commons into a local directory
Thank you to those who tried to help. I found the answer to my problem here. this is How I did it: import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPReply; public class FTPExample { public static void main(String[] args) { try { //new ftp client FTPClient ftp = new FTPClient(); //try to connect ftp.connect("MyHhostName"); //login to server if (!ftp.login("username", "password")) { ftp.logout(); } int reply = ftp.getReplyCode(); //FTPReply stores a set of constants for FTP reply codes.

Categories : Java

SQL Server 2008: Select returns multiple results instead of 1 per user in a month
If I can understand your query, You group by things you don't want such as UP_AveCallTime, UP_TotCallTime, U_UserName, UP_LogOn, UP_LogOff , so remove them from the group by for your AveCallTime,TotCallTime,HoursOfMonth you will want to use SUM or AVG depending on your logic

Categories : SQL

How to write a Validation inside my model class to check if the user is Inside Active Directory or not
Please try this code: var searchResults = searcher.FindAll(); foreach (Principal p in searchResults) { if(p.SamAccountName == User.Identity.Name) { //your in! } }

Categories : C#

Active Directory user entry, and group entry
Use the below code PrincipalContext ouContex = new PrincipalContext(ContextType.Domain, "TestDomain.local", "OU=TestOU,DC=TestDomain,DC=local"); for (int i = 0; i < 3; i++) { try { UserPrincipal up = new UserPrincipal(ouContex); up.SamAccountName = "TestUser" + i; up.SetPassword("password"); up.Enabled = true; up.ExpirePasswordNow(); up.Save(); } catch (Exception ex) { } }

Categories : C#

Check to see if user exists (all the user accounts are stored in a file)
#include<iostream> #include<conio.h> #include<vector> #include<string> #include<fstream> using namespace std; int main() { string name = ""; string line = ""; fstream f; f.open("a.txt"); cout<<"Enter name"<<endl; cin>>name; if (f.is_open()) { while (f.good() ) { getline(f,line); if(line==name) { cout<<"You can log in"; //Or do whatever you please in here after the username is found in the file } } f.close(); } else { cout << "Unable to open file"; } getch(); return 0; }

Categories : C++

How to set gecos attribute in Active Directory using directory services(C#)
I finally found the way to access the attribute. Instead of using directly the DirectoryEntry to connect to the LDAP such as : DirectoryEntry DEBase = new DirectoryEntry("LDAP://" + DomaineName); I used DirectoryContext context = new DirectoryContext(DirectoryContextType.Domain, domaineName)); DirectoryEntry dERoot = System.DirectoryServices.ActiveDirectory.Domain.GetDomain(context).GetDirectoryEntry(); Then I have no problem accessing the gecos attribute

Categories : C#

Linux: Move log files from a mounted dir to a local dir recursively while maintaining directory structure in local direcoty
How about something like rsync -azrR --include='*.log' -f 'hide,! */' /media/primary /backup If you use man rsync and type 2343g it should take you to the line where it explains this filter. Basically it will hide everything that's not a directory (every file) from the pattern matching; however, since I've used the --include='*.log' flag as well it will override that and the pattern will match only .log files. You can also use the -nv flag to do a dry run and see what would happen.

Categories : PHP

How to set up local repo to have different root directory than remote "upstream" directory of an open source project?
Broadly speaking, No. Git does not allow you to have two different view of the same repository that have different directory structures. Solution 1: Ignore git altogether for uploading That said, I think you don't need this anyway. If your webhost provides public_html, why not just scp the files you want to the location you want? You could make this a task in a Makefile/Rakefile/whatever and then run it from your local machine when you want to upload, for example, a makefile task could look like: upload: scp -r ./upload/* me@myhost:/home/me/public_html/ .PHONY: upload Solution 2: link into your git directory on your webhost Instead of manually uploading your files, simply link your public_html directory to your upload directory in your git repository on your server. For example:

Categories : GIT

identifying a user with two accounts
There are solutions with disadvantages.. In my opinion, I think there isn't an effective way to prevent users to create multiple accounts. As you have pointed, you can store the IP's, name machines, session_id() in PHP.. and do some analytics control, but this can bring you false positives. Users who share same IP, same machine.. A possible solution is make the things difficult. Using some kind of user validations, like validate phone, validate mail, answer a long register form.. Eventualy this may have the attackers think twice about the cost of doing extra work to create multiple accounts.. The disavantatge is real users must do the same, and maybe they will not go to your site with this kind of validations. It's hard to choose between thoose. Another possible solution is made th

Categories : PHP

PHP Mod rewrite for user accounts
Here is the code for your .htaccess file. RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^user/([^/]*)/([^/]*)$ profile.php?username=$1&page=$2 [NC,L]

Categories : PHP

Google User Accounts
Applications do not have automatic access to your gmail account, nor are you automatically logged into your app if you are logged into your gmail. That would be pretty dangerous - all GAE apps could collect user emails if user visited their Url. Users still need to login into your app, e.g. go through a federated login.

Categories : Google App Engine

Duplicate User accounts
If you want to forbid entering the same values twice in a table create a unique index. Checking for an existent entry is one thing - prohibiting that another row with same values can be inserted is another thing. Adding such an index works like this: ALTER TABLE `users` ADD UNIQUE `MY_UNIQUE_INDEX` ( `username` )

Categories : PHP

How do you delete user accounts in Meteor?
You could do meteor mongo or meteor mongo myapp.meteor.com for a deployed app Then db.users.remove({_id:<user id>}); I wouldn't recommend it but if you want to delete any user without being logged in from meteor you would need to modify the allow rules. But deleting a user is a very unlikely event hence the above might be the best way to do it. Anyway if you do want, modify the Meteor.users.allow({remove:function() { return true }); property. See http://docs.meteor.com/#allow. You could add in some custom logic there so it'll only let you do so if you're the admin

Categories : Meteor

Creating FTP user accounts using FTP on server
FTP user's use the same login as other logins. You can create new users using the following command: # adduser -c 'FTP USER Tom' -m tom Then, change tom's password: # passwd tom Note: For passwd, this is an interactive shell, so you may need to use passthru() or other methods - you can research these yourself. Also, these sorts of questions are nothing to do with PHP, and more suited to http://www.superuser.com. On the PHP side, you can use mkdir() for creating directories. To do these things via PHP, you can use exec(): this basically executes shell commands for you. You would use: exec("adduser -c 'FTP USER Tom' -m tom"); Make sure you escape your strings correctly, and if you're accepting user input into these commands, make sure you escape them with escapeshellarg().

Categories : PHP

Is Django and Active Python 2.x for production environments on Windows 2008 R2 with IIS 7.5?
I used http://django-windows-tools.readthedocs.org/en/latest/ to successfully accomplish this. Note that Running Python & Django on IIS is a reasonably similar question here on stackoverflow.

Categories : Python

Change encryption methods with existing user accounts
Check these links out, CakePHP already supports different hashing methods and bcrypt. http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-bcrypt-for-passwords http://api.cakephp.org/2.3/class-Security.html#$hashType http://api.cakephp.org/2.3/source-class-Security.html#140-150 http://api.cakephp.org/2.3/source-class-Security.html#275 If your own hashing method is different the best way is to validate the hash on login against the hold hash using the old hashing method. If its true use the plain password and hash it using the new hash method and save it and you've migrated it "on the fly". If the old hash check fails check against the second, the new hash method. You could flag your users as migrated and when they're all done stop using both checks.

Categories : PHP

Is this the right way to store passwords in database and activate user accounts?
No that's not what you should do, the parameters for crypt() require a certain format, otherwise you will not get a BCrypt value and the salt will not be secure. In PHP 5.5 there is a function called password_hash() which solves exactly your problem, for earlier versions there exists a compatibilty pack from the same author, using this function is "future proof". Activation keys should better not be derrived from other parameters, just generate a random token and send this token to the user. In the database you store only a hash of this token. This system can be used to generate password reset links too. An example implementation of a such tokens you can find here.

Categories : PHP

How do PhoneGap applications typically handle user accounts?
I know this is late, but if you ever decide to go with option 3, you might want to try Parse.com (which also supports Facebook logins). I've successfully used it with PhoneGap, and there's a tutorial by Raymond Camden that may help you get started.

Categories : Facebook

Retrieving twitter user data with iOS Social / Accounts frameworks
Yes, you can get user information using ACAccountStore, You have to retain ACAccountStore: .h @property (nonatomic, strong) ACAccountStore *account; .m NSUrl *url = [NSURL URLWithString:@"https://api.twitter.com/1.1/users/show.json"]; NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:twittername,@"screen_name",nil]; account = [[ACAccountStore alloc] init]; ACAccountType *twitterAccountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; NSArray *twitterAccounts = [account accountsWithAccountType:twitterAccountType]; // Runing on iOS 6 if (NSClassFromString(@"SLComposeViewController") && [SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) { [account requestAccessToAccou

Categories : IOS

Google App Engine remote_api for sharing user accounts across apps
I think this is a good use for the new modules feature. https://developers.google.com/appengine/docs/python/modules/ But if you don't want to use modules you'll need to create web services for communicating between apps.

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.