2
0

Complete security questions model.

This commit is contained in:
Maarten Billemont
2018-05-16 12:00:42 -04:00
parent 1b703515dd
commit c51262ccc2
7 changed files with 100 additions and 44 deletions

View File

@@ -0,0 +1,47 @@
//==============================================================================
// This file is part of Master Password.
// Copyright (c) 2011-2017, Maarten Billemont.
//
// Master Password is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Master Password is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You can find a copy of the GNU General Public License in the
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
package com.lyndir.masterpassword.gui.model;
import static com.lyndir.lhunath.opal.system.util.ObjectUtils.ifNotNullElse;
import com.lyndir.masterpassword.MPResultType;
import com.lyndir.masterpassword.model.impl.MPBasicQuestion;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* @author lhunath, 2018-05-16
*/
public class MPIncognitoQuestion extends MPBasicQuestion {
private final MPIncognitoSite site;
public MPIncognitoQuestion(final MPIncognitoSite site, final String keyword, @Nullable final MPResultType type) {
super( keyword, ifNotNullElse( type, site.getAlgorithm().mpw_default_answer_type() ) );
this.site = site;
}
@Nonnull
@Override
public MPIncognitoSite getSite() {
return site;
}
}

View File

@@ -18,20 +18,17 @@
package com.lyndir.masterpassword.gui.model;
import com.google.common.collect.ImmutableList;
import com.google.common.primitives.UnsignedInteger;
import com.lyndir.masterpassword.MPAlgorithm;
import com.lyndir.masterpassword.MPResultType;
import com.lyndir.masterpassword.model.*;
import com.lyndir.masterpassword.model.impl.MPBasicSite;
import java.util.Collection;
import javax.annotation.Nullable;
/**
* @author lhunath, 14-12-16
*/
public class MPIncognitoSite extends MPBasicSite {
public class MPIncognitoSite extends MPBasicSite<MPIncognitoQuestion> {
private final MPIncognitoUser user;
@@ -48,12 +45,7 @@ public class MPIncognitoSite extends MPBasicSite {
}
@Override
public MPUser<? extends MPSite> getUser() {
public MPIncognitoUser getUser() {
return user;
}
@Override
public Collection<MPQuestion> getQuestions() {
return ImmutableList.of();
}
}