Skip to content

Commit

Permalink
FEATURE: Added support for Windows SSO Authentication.
Browse files Browse the repository at this point in the history
  • Loading branch information
cprieto committed Aug 23, 2013
1 parent 8fe644c commit bc5344b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
14 changes: 14 additions & 0 deletions server/src/org/tsqlt/runner/server/CredentialValidator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.tsqlt.runner.server;

import org.jetbrains.annotations.NotNull;
import org.tsqlt.runner.common.PropertyNames;

import java.util.Map;

public abstract class CredentialValidator {
protected boolean needsWindowsAuthentication(@NotNull Map<String, String> properties) {
boolean useWinAuth = properties.containsKey(PropertyNames.WINDOWS_AUTH)
? Boolean.parseBoolean(properties.get(PropertyNames.WINDOWS_AUTH)) : false;
return useWinAuth;
}
}
7 changes: 3 additions & 4 deletions server/src/org/tsqlt/runner/server/DomainUserValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

import java.util.Map;

public class DomainUserValidator implements Validator {
public class DomainUserValidator extends CredentialValidator implements Validator {
@Override
public InvalidProperty hasErrors(@NotNull Map<String, String> properties) {
boolean useWinAuth = properties.containsKey(PropertyNames.WINDOWS_AUTH)
? Boolean.parseBoolean(properties.get(PropertyNames.WINDOWS_AUTH)) : false;

if (useWinAuth) return null;
if (needsWindowsAuthentication(properties)) return null;

String user = properties.get(PropertyNames.USER_DOMAIN);
if (user == null || user.trim().isEmpty())
Expand All @@ -26,3 +24,4 @@ public InvalidProperty hasErrors(@NotNull Map<String, String> properties) {
return null;
}
}

5 changes: 4 additions & 1 deletion server/src/org/tsqlt/runner/server/PasswordValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

import java.util.Map;

public class PasswordValidator implements Validator {
public class PasswordValidator extends CredentialValidator implements Validator {
@Override
public InvalidProperty hasErrors(Map<String, String> properties) {
if (needsWindowsAuthentication(properties))
return null;

String password = properties.get(PropertyNames.USER_PASSWORD);
if (password == null || password.isEmpty())
return new InvalidProperty(PropertyNames.USER_PASSWORD, "You need to specify a password for the user");
Expand Down

0 comments on commit bc5344b

Please sign in to comment.