19 lines
		
	
	
		
			464 B
		
	
	
	
		
			Ruby
		
	
	
	
		
		
			
		
	
	
			19 lines
		
	
	
		
			464 B
		
	
	
	
		
			Ruby
		
	
	
	
| 
								 | 
							
								# Warden::Strategies.add(:check_nccu_ldap) do
							 | 
						||
| 
								 | 
							
								#   def valid? 
							 | 
						||
| 
								 | 
							
								#     # code here to check whether to try and authenticate using this strategy; 
							 | 
						||
| 
								 | 
							
								#     params['nccu_ldap_uid'] && params['password']
							 | 
						||
| 
								 | 
							
								#   end 
							 | 
						||
| 
								 | 
							
								#   def authenticate!
							 | 
						||
| 
								 | 
							
								#     debugger
							 | 
						||
| 
								 | 
							
								#     user = User.first(conditions:{ nccu_ldap_uid: "901001" })
							 | 
						||
| 
								 | 
							
								#     if user
							 | 
						||
| 
								 | 
							
								#       success! user
							 | 
						||
| 
								 | 
							
								#     else
							 | 
						||
| 
								 | 
							
								#       success! User.create
							 | 
						||
| 
								 | 
							
								#       
							 | 
						||
| 
								 | 
							
								#       # fail!(message)
							 | 
						||
| 
								 | 
							
								#       # User.create 
							 | 
						||
| 
								 | 
							
								#     end
							 | 
						||
| 
								 | 
							
								#   end
							 | 
						||
| 
								 | 
							
								# 
							 | 
						||
| 
								 | 
							
								# end
							 |