X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dashboard%2Fwebapp-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fmodel%2FEcompUserDetails.java;h=f58dae8eeb2204faed7450c9f7ca3e265f8816ec;hb=0bf1e8c65fb6b3c2a011e25587500fa45d50d6c0;hp=7bc9f0044e3ff97e60b0c2a4b558e8f0ea8b70f5;hpb=3b1e23945b9426ad7aaacfc3794e15286d82c816;p=nonrtric.git diff --git a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/EcompUserDetails.java b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/EcompUserDetails.java index 7bc9f004..f58dae8e 100644 --- a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/EcompUserDetails.java +++ b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/EcompUserDetails.java @@ -3,13 +3,14 @@ * O-RAN-SC * %% * Copyright (C) 2019 AT&T Intellectual Property + * Modifications Copyright (C) 2020 Nordix Foundation * %% * 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. @@ -32,54 +33,61 @@ import org.springframework.security.core.userdetails.UserDetails; public class EcompUserDetails implements UserDetails { - private static final long serialVersionUID = 1L; - private final EcompUser ecompUser; + private static final long serialVersionUID = 1L; + private final transient EcompUser ecompUser; - // This is the default Spring role-name prefix. - private static final String ROLEP = "ROLE_"; + // This is the default Spring role-name prefix. + private static final String ROLEP = "ROLE_"; - public EcompUserDetails(EcompUser ecompUser) { - this.ecompUser = ecompUser; - } + public EcompUserDetails(EcompUser ecompUser) { + this.ecompUser = ecompUser; + } - /* - * Gets a list of authorities (roles) for this user. To keep Spring happy, every - * item has prefix ROLE_. - */ - public Collection getAuthorities() { - List roleList = new ArrayList<>(); - Iterator roleIter = ecompUser.getRoles().iterator(); - while (roleIter.hasNext()) { - EcompRole role = roleIter.next(); - // Add the prefix if the ONAP portal doesn't supply it. - final String roleName = role.getName().startsWith(ROLEP) ? role.getName() : ROLEP + role.getName(); - roleList.add(new SimpleGrantedAuthority(roleName)); - } - return roleList; - } + /* + * Gets a list of authorities (roles) for this user. To keep Spring happy, every + * item has prefix ROLE_. + */ + @Override + public Collection getAuthorities() { + List roleList = new ArrayList<>(); + Iterator roleIter = ecompUser.getRoles().iterator(); + while (roleIter.hasNext()) { + EcompRole role = roleIter.next(); + // Add the prefix if the ONAP portal doesn't supply it. + final String roleName = role.getName().startsWith(ROLEP) ? role.getName() : ROLEP + role.getName(); + roleList.add(new SimpleGrantedAuthority(roleName)); + } + return roleList; + } - public String getPassword() { - return null; - } + @Override + public String getPassword() { + return null; + } - public String getUsername() { - return ecompUser.getLoginId(); - } + @Override + public String getUsername() { + return ecompUser.getLoginId(); + } - public boolean isAccountNonExpired() { - return true; - } + @Override + public boolean isAccountNonExpired() { + return true; + } - public boolean isAccountNonLocked() { - return true; - } + @Override + public boolean isAccountNonLocked() { + return true; + } - public boolean isCredentialsNonExpired() { - return true; - } + @Override + public boolean isCredentialsNonExpired() { + return true; + } - public boolean isEnabled() { - return ecompUser.isActive(); - } + @Override + public boolean isEnabled() { + return ecompUser.isActive(); + } }