org.hostsharing.hsadminng logging on INFO level and logging in SecurityUtils
This commit is contained in:
parent
53382beb88
commit
5d843f4725
@ -1,6 +1,8 @@
|
|||||||
package org.hostsharing.hsadminng.security;
|
package org.hostsharing.hsadminng.security;
|
||||||
|
|
||||||
import org.hostsharing.hsadminng.service.accessfilter.Role;
|
import org.hostsharing.hsadminng.service.accessfilter.Role;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.core.context.SecurityContext;
|
import org.springframework.security.core.context.SecurityContext;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
@ -14,6 +16,8 @@ import java.util.Optional;
|
|||||||
*/
|
*/
|
||||||
public final class SecurityUtils {
|
public final class SecurityUtils {
|
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(SecurityUtils.class);
|
||||||
|
|
||||||
private static List<UserRoleAssignment> userRoleAssignments = new ArrayList<>();
|
private static List<UserRoleAssignment> userRoleAssignments = new ArrayList<>();
|
||||||
|
|
||||||
private SecurityUtils() {
|
private SecurityUtils() {
|
||||||
@ -86,6 +90,7 @@ public final class SecurityUtils {
|
|||||||
? ura.role
|
? ura.role
|
||||||
: Role.ANYBODY).
|
: Role.ANYBODY).
|
||||||
reduce(Role.ANYBODY, (r1, r2) -> r1.covers(r2) ? r1 : r2);
|
reduce(Role.ANYBODY, (r1, r2) -> r1.covers(r2) ? r1 : r2);
|
||||||
|
log.info("getLoginUserRoleFor({}, {}) returned {}", onDtoClass, onId, highestRole);
|
||||||
return highestRole;
|
return highestRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +101,7 @@ public final class SecurityUtils {
|
|||||||
|
|
||||||
// TODO: depends on https://plan.hostsharing.net/project/hsadmin/us/67?milestone=34
|
// TODO: depends on https://plan.hostsharing.net/project/hsadmin/us/67?milestone=34
|
||||||
public static void addUserRole(final Class<?> onClass, final Long onId, final Role role) {
|
public static void addUserRole(final Class<?> onClass, final Long onId, final Role role) {
|
||||||
|
log.info("addUserRole({}, {}, {})", onClass, onId, role);
|
||||||
userRoleAssignments.add(new UserRoleAssignment(onClass, onId, role));
|
userRoleAssignments.add(new UserRoleAssignment(onClass, onId, role));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
<appender-ref ref="ASYNC"/>
|
<appender-ref ref="ASYNC"/>
|
||||||
</root>
|
</root>
|
||||||
-->
|
-->
|
||||||
|
<logger name="org.hostsharing.hsadminng" level="INFO"/>
|
||||||
|
|
||||||
<logger name="javax.activation" level="WARN"/>
|
<logger name="javax.activation" level="WARN"/>
|
||||||
<logger name="javax.mail" level="WARN"/>
|
<logger name="javax.mail" level="WARN"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user