Improve coverage and silence sonar warnings
[portal/ric-dashboard.git] / webapp-backend / src / main / java / org / oransc / ric / portal / dashboard / model / EcompUserDetails.java
index 8091983..30cab78 100644 (file)
@@ -2,14 +2,14 @@
  * ========================LICENSE_START=================================
  * O-RAN-SC
  * %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * Copyright (C) 2019 AT&T Intellectual Property
  * %%
  * 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.
@@ -33,7 +33,8 @@ import org.springframework.security.core.userdetails.UserDetails;
 public class EcompUserDetails implements UserDetails {
 
        private static final long serialVersionUID = 1L;
-       private final EcompUser ecompUser;
+       // use transient per Sonar warning
+       private final transient EcompUser ecompUser;
 
        // This is the default Spring role-name prefix.
        private static final String ROLEP = "ROLE_";
@@ -82,4 +83,11 @@ public class EcompUserDetails implements UserDetails {
                return ecompUser.isActive();
        }
 
+       @Override
+       public String toString() {
+               return this.getClass().getName() + "[ecompUser=" + ecompUser + ", isAccountNonExpired=" + isAccountNonExpired()
+                               + ", isAccountNonLocked=" + isAccountNonLocked() + ", isCredentialsNonExpired="
+                               + isCredentialsNonExpired() + "]";
+       }
+
 }