mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
Moved AuthenticationContext to sse.security.ui
This commit is contained in:
1 parent
e5798f89fe
commit
8ebdb82b88
3 files changed
+2
-1
No files matched your search
@@ -24,7 +24,8 @@ Require-Bundle: javax.servlet;bundle-version="2.5.0",
|
||||
com.sap.sse.security.common,
|
||||
com.sap.sse.mail
|
||||
Web-ContextPath: /security/ui
|
||||
Export-Package: com.sap.sse.security.ui.client,
|
||||
Export-Package: com.sap.sailing.gwt.home.shared.usermanagement.app,
|
||||
com.sap.sse.security.ui.client,
|
||||
com.sap.sse.security.ui.client.component,
|
||||
com.sap.sse.security.ui.client.i18n,
|
||||
com.sap.sse.security.ui.client.usermanagement,
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.sap.sailing.gwt.home.shared.usermanagement.app;
|
||||
|
||||
import com.sap.sse.security.ui.shared.UserDTO;
|
||||
|
||||
public interface AuthenticationContext {
|
||||
|
||||
boolean isLoggedIn();
|
||||
|
||||
UserDTO getCurrentUser();
|
||||
|
||||
String getUserTitle();
|
||||
|
||||
String getUserSubtitle();
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package com.sap.sailing.gwt.home.shared.usermanagement.app;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.sap.sse.security.ui.shared.AccountDTO;
|
||||
import com.sap.sse.security.ui.shared.UserDTO;
|
||||
|
||||
public class AuthenticationContextImpl implements AuthenticationContext {
|
||||
|
||||
private final UserDTO currentUser;
|
||||
private final static UserDTO ANONYMOUS = new UserDTO("Anonymous", "", "", "", false, new ArrayList<AccountDTO>(),
|
||||
new ArrayList<String>(), new ArrayList<String>());
|
||||
|
||||
public AuthenticationContextImpl() {
|
||||
this.currentUser = ANONYMOUS;
|
||||
}
|
||||
|
||||
public AuthenticationContextImpl(UserDTO currentUser) {
|
||||
if (currentUser == null) {
|
||||
this.currentUser = ANONYMOUS;
|
||||
} else {
|
||||
this.currentUser = currentUser;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoggedIn() {
|
||||
return (currentUser != ANONYMOUS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO getCurrentUser() {
|
||||
return currentUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserTitle() {
|
||||
final String fullName = currentUser.getFullName();
|
||||
if(fullName != null && !fullName.isEmpty()) {
|
||||
return fullName;
|
||||
}
|
||||
return currentUser.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserSubtitle() {
|
||||
final String company = currentUser.getCompany();
|
||||
if(company != null && !company.isEmpty()) {
|
||||
return company;
|
||||
}
|
||||
final String email = currentUser.getEmail();
|
||||
if(email != null && !email.isEmpty()) {
|
||||
return email;
|
||||
}
|
||||
return currentUser.getName();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user