/* * #%L * BroadleafCommerce Open Admin Platform * %% * Copyright (C) 2009 - 2013 Broadleaf Commerce * %% * 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. * #L% */ package org.broadleafcommerce.openadmin.server.security.service; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.User; import java.util.Collection; /** * Extended DTO class to support salts based on the primary key of the admin user. This allows username changes for * admin users. * * @see {@link AdminSecurityService} * @see {@link AdminUserDetailsServiceImpl} * @author Phillip Verheyden (phillipuniverse) */ public class AdminUserDetails extends User { private static final long serialVersionUID = 1L; protected Long id; public AdminUserDetails(Long id, String username, String password, Collection<? extends GrantedAuthority> authorities) { this(id, username, password, true, true, true, true, authorities); } public AdminUserDetails(Long id, String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) { super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities); this.id = id; } public AdminUserDetails withId(Long id) { setId(id); return this; } /** * @return the primary key of the Admin User */ public Long getId() { return id; } /** * @param id the primary key of the Admin User */ public void setId(Long id) { this.id = id; } }