001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.security.auth.verifier;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    
019    import java.util.HashMap;
020    import java.util.Map;
021    
022    /**
023     * @author Tomas Polesovsky
024     */
025    public class AuthVerifierResult {
026    
027            public String getPassword() {
028                    return _password;
029            }
030    
031            public Map<String, Object> getSettings() {
032                    return _settings;
033            }
034    
035            public State getState() {
036                    return _state;
037            }
038    
039            public long getUserId() {
040                    return _userId;
041            }
042    
043            public boolean isPasswordBasedAuthentication() {
044                    return _passwordBasedAuthentication;
045            }
046    
047            public void setPassword(String password) {
048                    _password = password;
049            }
050    
051            public void setPasswordBasedAuthentication(
052                    boolean passwordBasedAuthentication) {
053    
054                    _passwordBasedAuthentication = passwordBasedAuthentication;
055            }
056    
057            public void setSettings(Map<String, Object> settings) {
058                    _settings = settings;
059            }
060    
061            public void setState(State state) {
062                    _state = state;
063            }
064    
065            public void setUserId(long userId) {
066                    _userId = userId;
067            }
068    
069            @Override
070            public String toString() {
071                    StringBundler sb = new StringBundler(7);
072    
073                    sb.append("{settings=");
074                    sb.append(_settings);
075                    sb.append(", state=");
076                    sb.append(_state);
077                    sb.append(", userId=");
078                    sb.append(_userId);
079                    sb.append("}");
080    
081                    return sb.toString();
082            }
083    
084            public enum State {
085    
086                    NOT_APPLICABLE, INVALID_CREDENTIALS, SUCCESS
087    
088            }
089    
090            private String _password;
091            private boolean _passwordBasedAuthentication;
092            private Map<String, Object> _settings = new HashMap<>();
093            private State _state = State.NOT_APPLICABLE;
094            private long _userId;
095    
096    }