use of org.apereo.cas.adaptors.gauth.repository.credentials.GoogleAuthenticatorAccount in project cas by apereo.
the class JpaGoogleAuthenticatorTokenCredentialRepository method save.
@Override
public void save(final String userName, final String secretKey, final int validationCode, final List<Integer> scratchCodes) {
final GoogleAuthenticatorAccount r = new GoogleAuthenticatorAccount(userName, secretKey, validationCode, scratchCodes);
this.entityManager.merge(r);
}
use of org.apereo.cas.adaptors.gauth.repository.credentials.GoogleAuthenticatorAccount in project cas by apereo.
the class MongoDbGoogleAuthenticatorTokenCredentialRepository method save.
@Override
public void save(final String userName, final String secretKey, final int validationCode, final List<Integer> scratchCodes) {
final GoogleAuthenticatorAccount account = new GoogleAuthenticatorAccount(userName, secretKey, validationCode, scratchCodes);
this.mongoTemplate.save(account, this.collectionName);
}
use of org.apereo.cas.adaptors.gauth.repository.credentials.GoogleAuthenticatorAccount in project cas by apereo.
the class MongoDbGoogleAuthenticatorTokenCredentialRepository method getSecret.
@Override
public String getSecret(final String username) {
try {
final Query query = new Query();
query.addCriteria(Criteria.where("username").is(username));
final GoogleAuthenticatorAccount r = this.mongoTemplate.findOne(query, GoogleAuthenticatorAccount.class, this.collectionName);
if (r != null) {
return r.getSecretKey();
}
} catch (final NoResultException e) {
LOGGER.debug("No record could be found for google authenticator id [{}]", username);
}
return null;
}
Aggregations