com.github.carlomicieli.nerdmovies.models.MongoRememberMeToken.java Source code

Java tutorial

Introduction

Here is the source code for com.github.carlomicieli.nerdmovies.models.MongoRememberMeToken.java

Source

/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.github.carlomicieli.nerdmovies.models;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.security.web.authentication.rememberme.PersistentRememberMeToken;

import java.util.Date;

/**
 * It represents the Mongodb document used to persist
 * the remember me tokens.
 *
 * @author Carlo Micieli
 */
@Document(collection = "persistentLogins")
public class MongoRememberMeToken {
    public MongoRememberMeToken() {
    }

    public MongoRememberMeToken(PersistentRememberMeToken token) {
        this.setDate(token.getDate());
        this.setSeries(token.getSeries());
        this.setTokenValue(token.getTokenValue());
        this.setUsername(token.getUsername());
    }

    @Id
    private String series;
    private Date date;
    private String tokenValue;
    private String username;

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public String getSeries() {
        return series;
    }

    public void setSeries(String series) {
        this.series = series;
    }

    public String getTokenValue() {
        return tokenValue;
    }

    public void setTokenValue(String tokenValue) {
        this.tokenValue = tokenValue;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
}