/*
 * Copyright 2017 Banco Bilbao Vizcaya Argentaria, S.A..
 *
 * 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.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bbva.arq.devops.ae.mirrorgate.security;

import java.util.Arrays;
import java.util.Collections;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.util.StringUtils;


public class TokenCreator {

    private TokenCreator(){}

    public static MirrorgateAuthenticationToken createHeaderBasedToken(String headerValue){

        GrantedAuthority authority;

        if(!StringUtils.isEmpty(headerValue)){

            if(headerValue.contains("ANONYMOUS")) {
                authority = new SimpleGrantedAuthority(SecurityAuthoritiesEnum.SCREEN.toString());
            } else {
                authority = new SimpleGrantedAuthority(SecurityAuthoritiesEnum.REGULAR.toString());
            }

        } else {
            authority = new SimpleGrantedAuthority(SecurityAuthoritiesEnum.COLLECTOR.toString());
        }

        return new MirrorgateAuthenticationToken(headerValue, Collections.unmodifiableList(Arrays.asList(authority)));
    }

}

@@ -723,16 +723,74 @@
 ections;
+%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0Aimport 
@@ -992,16 +992,110 @@
 ator %7B%0A%0A
+    private static final Logger LOG = LoggerFactory.getLogger(TokenCreator.class.getName());%0A%0A
     priv
@@ -1699,32 +1699,97 @@
 ());%0A        %7D%0A%0A
+        LOG.info(%22Role assigned: %22 + authority.getAuthority());%0A%0A
         return n

add log info traces