cn.wic4j.security.resource.Wic4jOauth2UserDetails Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 cn.wic4j.security.resource;
import cn.wi4j.security.core.Wic4jUserDetails;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.oauth2.core.OAuth2AuthenticatedPrincipal;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
*
*
* @author Max
* @version 2023.0.0.0
* @since 2023/7/11 23:43
*/
public class Wic4jOauth2UserDetails extends Wic4jUserDetails implements OAuth2AuthenticatedPrincipal {
public Wic4jOauth2UserDetails(String id, String username, String password, String nickName, String email, String avatar, String mobileNumber, List roles, boolean tUse, Collection extends GrantedAuthority> authorities) {
super(id, username, password, nickName, email, avatar, mobileNumber, roles, tUse, authorities);
}
/**
* Get the OAuth 2.0 token attributes
*
* @return the OAuth 2.0 token attributes
*/
@Override
public Map getAttributes() {
return Collections.emptyMap();
}
/**
* Returns the name of the authenticated Principal
. Never
* null
.
*
* @return the name of the authenticated Principal
*/
@Override
public String getName() {
return super.getUsername();
}
}