package org.apereo.cas.config;

import com.github.dbadia.sqrl.server.SqrlConfig;
import com.github.dbadia.sqrl.server.SqrlServerOperations;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.sqrl.SqrlCallbabckController;
import org.apereo.cas.util.DigestUtils;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

/**
 * This is {@link SqrlConfiguration}.
 *
 * @author Misagh Moayyed
 * @since 5.2.0
 */
@Configuration("SqrlConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class SqrlConfiguration {

    @Bean
    public SqrlConfig sqrlConfig() {
        try {
            final SqrlConfig c = new SqrlConfig();
            final byte[] key = DigestUtils.sha("thekey".getBytes("UTF-8"));
            c.setAESKeyBytes(Arrays.copyOf(key, 16));
            c.setBackchannelServletPath("/cas/sqlcallback");
            return c;
        } catch (final Exception e) {
            throw new BeanCreationException(e.getMessage(), e);
        }
    }

    @Bean
    public SqrlServerOperations sqrlServerOperations() {
        final SqrlServerOperations c = new SqrlServerOperations(sqrlConfig());
        return c;
    }

    @Bean
    public SqrlCallbabckController sqrlCallbackController() {
        return new SqrlCallbabckController(sqrlConfig(), sqrlServerOperations());
    }
}

@@ -800,16 +800,68 @@
 ation %7B%0A
+    private static final int AES_KEY_SIZE = 16;%0A    
 %0A    @Be
@@ -1089,18 +1089,28 @@
 Of(key, 
-16
+AES_KEY_SIZE
 ));%0A    

Fix checkstyle issues