<commit_before>'use strict';

var mongoose = require('mongoose'),
  LDAPStrategy = require('passport-ldapauth').Strategy,
  TokLocalStrategy = require('passport-local').Strategy,
  BasicRegisterStrategy = require('passport-http').BasicStrategy,
  User = mongoose.model('User'),
  AuthClient = mongoose.model('AuthClient'),
  config = require('meanio').loadConfig();

module.exports = function(passport){
    
    /*This strategy will run over LDAP and generate a JWT to keep API operations*/
    
    passport.use('official',new LDAPStrategy(
        {
            server: {
                url: config.ldap.url,
                bindCredentials: '',
                searchBase: config.ldap.base,
                searchFilter: '(uid={{username}})'
            }
        },
        
        function(profile, done) {
            
            User.findOne({
                'username': profile.uid 
            }, function(err, user) {
            
                if (err) {
                    return done(err);
                }
                <commit_msg>Changed ldap search filter<commit_after>'use strict';

var mongoose = require('mongoose'),
  LDAPStrategy = require('passport-ldapauth').Strategy,
  TokLocalStrategy = require('passport-local').Strategy,
  BasicRegisterStrategy = require('passport-http').BasicStrategy,
  User = mongoose.model('User'),
  AuthClient = mongoose.model('AuthClient'),
  config = require('meanio').loadConfig();

module.exports = function(passport){
    
    /*This strategy will run over LDAP and generate a JWT to keep API operations*/
    
    passport.use('official',new LDAPStrategy(
        {
            server: {
                url: config.ldap.url,
                bindCredentials: '',
                searchBase: config.ldap.base,
                searchFilter: '(&(uid={{username}})(objectClass=posixAccoun))'
            }
        },
        
        function(profile, done) {
            
            User.findOne({
                'username': profile.uid 
            }, function(err, user) {
            
                if (err) {
                    return done(err);
                }
                
{'fraction_non_alphanumeric': 0.1197215777262181, 'fraction_numerical': 0.0, 'mean_word_length': 1.8293963254593175, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1683531', 'n_tokens_mistral': 574, 'n_tokens_neox': 564, 'n_words': 111}