Search in sources :

Example 1 with ProfileForm

use of com.webauthn4j.springframework.security.webauthn.sample.app.api.ProfileForm in project webauthn4j-spring-security by webauthn4j.

the class AppSpecificMapper method mapToProfileForm.

public ProfileForm mapToProfileForm(UserEntity userEntity) {
    ProfileForm profileForm = new ProfileForm();
    profileForm.setId(userEntity.getId());
    profileForm.setUserHandle(mapToBase64Url(userEntity.getUserHandle()));
    profileForm.setFirstName(userEntity.getFirstName());
    profileForm.setLastName(userEntity.getLastName());
    profileForm.setEmailAddress(userEntity.getEmailAddress());
    // authenticators
    profileForm.setAuthenticators(new ArrayList<>());
    mapToAuthenticatorFormList(userEntity.getAuthenticators(), profileForm.getAuthenticators());
    profileForm.setSingleFactorAuthenticationAllowed(userEntity.getAuthorities().stream().anyMatch(authorityEntity -> authorityEntity.getAuthority().equals("SINGLE_FACTOR_AUTHN_ALLOWED")));
    return profileForm;
}
Also used : WebAuthnSampleEntityNotFoundException(com.webauthn4j.springframework.security.webauthn.sample.domain.exception.WebAuthnSampleEntityNotFoundException) Arrays(java.util.Arrays) AuthenticatorForm(com.webauthn4j.springframework.security.webauthn.sample.app.api.AuthenticatorForm) ProfileCreateForm(com.webauthn4j.springframework.security.webauthn.sample.app.api.ProfileCreateForm) ProfileForm(com.webauthn4j.springframework.security.webauthn.sample.app.api.ProfileForm) UserEntity(com.webauthn4j.springframework.security.webauthn.sample.domain.entity.UserEntity) AuthenticatorEntity(com.webauthn4j.springframework.security.webauthn.sample.domain.entity.AuthenticatorEntity) Autowired(org.springframework.beans.factory.annotation.Autowired) Base64UrlUtil(com.webauthn4j.util.Base64UrlUtil) ArrayList(java.util.ArrayList) Component(org.springframework.stereotype.Component) List(java.util.List) PasswordEncoder(org.springframework.security.crypto.password.PasswordEncoder) AuthorityEntity(com.webauthn4j.springframework.security.webauthn.sample.domain.entity.AuthorityEntity) ProfileUpdateForm(com.webauthn4j.springframework.security.webauthn.sample.app.api.ProfileUpdateForm) ProfileForm(com.webauthn4j.springframework.security.webauthn.sample.app.api.ProfileForm)

Aggregations

AuthenticatorForm (com.webauthn4j.springframework.security.webauthn.sample.app.api.AuthenticatorForm)1 ProfileCreateForm (com.webauthn4j.springframework.security.webauthn.sample.app.api.ProfileCreateForm)1 ProfileForm (com.webauthn4j.springframework.security.webauthn.sample.app.api.ProfileForm)1 ProfileUpdateForm (com.webauthn4j.springframework.security.webauthn.sample.app.api.ProfileUpdateForm)1 AuthenticatorEntity (com.webauthn4j.springframework.security.webauthn.sample.domain.entity.AuthenticatorEntity)1 AuthorityEntity (com.webauthn4j.springframework.security.webauthn.sample.domain.entity.AuthorityEntity)1 UserEntity (com.webauthn4j.springframework.security.webauthn.sample.domain.entity.UserEntity)1 WebAuthnSampleEntityNotFoundException (com.webauthn4j.springframework.security.webauthn.sample.domain.exception.WebAuthnSampleEntityNotFoundException)1 Base64UrlUtil (com.webauthn4j.util.Base64UrlUtil)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 PasswordEncoder (org.springframework.security.crypto.password.PasswordEncoder)1 Component (org.springframework.stereotype.Component)1