Java Code Examples for javax.security.enterprise.credential.UsernamePasswordCredential#compareTo()

The following examples show how to use javax.security.enterprise.credential.UsernamePasswordCredential#compareTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestIdentityStore.java    From piranha with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        if (usernamePasswordCredential.compareTo("test", "test")) {
            return new CredentialValidationResult("test", new HashSet<>(asList("architect")));
        }

        return INVALID_RESULT;
    }
 
Example 2
Source File: TestIdentityStore.java    From piranha with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        if (usernamePasswordCredential.compareTo("test", "test")) {
            return new CredentialValidationResult("test", new HashSet<>(asList("architect")));
        }

        return INVALID_RESULT;
    }
 
Example 3
Source File: LiteWeightIdentityStore.java    From Java-EE-8-Sampler with MIT License 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential userCredential) {

        if (userCredential.compareTo("admin", "pwd1")) {
            return new CredentialValidationResult("admin", new HashSet<>(asList("admin", "user", "demo")));
        }

        return INVALID_RESULT;
    }
 
Example 4
Source File: TestIdentityStore.java    From Architecting-Modern-Java-EE-Applications with MIT License 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        // validate
        // ...
        if (usernamePasswordCredential.compareTo("duke", "helloWorld")) {
            return new CredentialValidationResult("duke", singleton("admin"));
        }

        return CredentialValidationResult.INVALID_RESULT;
    }
 
Example 5
Source File: TestIdentityStore.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        if (usernamePasswordCredential.compareTo("user", "password")) {
            return new CredentialValidationResult("user", new HashSet<>(asList("foo", "bar")));
        }

        return INVALID_RESULT;
    }
 
Example 6
Source File: TestIdentityStore.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        if (usernamePasswordCredential.compareTo("user", "password")) {
            return new CredentialValidationResult("user", new HashSet<>(asList("foo", "bar")));
        }

        return INVALID_RESULT;
    }
 
Example 7
Source File: TestIdentityStore.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        if (usernamePasswordCredential.compareTo("user", "password")) {
            return new CredentialValidationResult("user", new HashSet<>(asList("foo", "bar")));
        }

        return INVALID_RESULT;
    }
 
Example 8
Source File: TestIdentityStore.java    From ee8-sandbox with Apache License 2.0 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        if (usernamePasswordCredential.compareTo("user", "password")) {
            return new CredentialValidationResult("user", new HashSet<>(asList("foo", "bar")));
        }

        return INVALID_RESULT;
    }
 
Example 9
Source File: SimpleIdentityStore.java    From thorntail with Apache License 2.0 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        if (usernamePasswordCredential.compareTo("thorntail1", "secret1")) {
            return new CredentialValidationResult("thorntail1", new HashSet<>(asList("role1")));
        } else if (usernamePasswordCredential.compareTo("thorntail2", "secret2")) {
            return new CredentialValidationResult("thorntail2", new HashSet<>(asList("role2")));
        }

        return INVALID_RESULT;
    }
 
Example 10
Source File: SimpleIdentityStore.java    From thorntail with Apache License 2.0 5 votes vote down vote up
public CredentialValidationResult validate(UsernamePasswordCredential usernamePasswordCredential) {

        if (usernamePasswordCredential.compareTo("thorntail1", "secret1")) {
            return new CredentialValidationResult("thorntail1", new HashSet<>(asList("role1")));
        } else if (usernamePasswordCredential.compareTo("thorntail2", "secret2")) {
            return new CredentialValidationResult("thorntail2", new HashSet<>(asList("role2")));
        }

        return INVALID_RESULT;
    }