@Override
	public IdentifyingToken validate(IdentifyingToken token, @Nullable ChargingStationId chargingStationId) {
		if (chargingStationId == null) {
            LOG.warn("No charging station id passed to validation request for token {}", token.getToken());
			return token;
		}

        ChargingStation chargingStation = repository.findOne(chargingStationId.getId());

		if (chargingStation == null) {
		    LOG.warn("Charging station not found in repository: {}", chargingStationId);
			return token;
		}

		List<String> chargingStationAuthorizationProviders = chargingStation.getAuthorizationProvidersAsList();

		if (chargingStationAuthorizationProviders.isEmpty()) {
		    LOG.warn("No authorization providers configured for charging station: {}", chargingStationId);
		    return token;
        }

        for (String authorizationProvider:chargingStationAuthorizationProviders) {
            AuthorizationProvider provider = providers.get(authorizationProvider);

            if (provider != null) {
                IdentifyingToken validatedToken = provider.validate(token, chargingStationId);
                if (validatedToken.isValid()) {
                    return validatedToken;
                }
            }
        }

		return token;
	}
@ Override public IdentifyingToken validate ( IdentifyingToken token , @ Nullable ChargingStationId chargingStationId ) { if ( chargingStationId == null ) { LOG . warn ( "No charging station id passed to validation request for token {}" , token . getToken ( ) ) ; return token ; } ChargingStation chargingStation = repository . findOne ( chargingStationId . getId ( ) ) ; if ( chargingStation == null ) { LOG . warn ( "Charging station not found in repository: {}" , chargingStationId ) ; return token ; } List < String > chargingStationAuthorizationProviders = chargingStation . getAuthorizationProvidersAsList ( ) ; if ( chargingStationAuthorizationProviders . isEmpty ( ) ) { LOG . warn ( "No authorization providers configured for charging station: {}" , chargingStationId ) ; return token ; } for ( String authorizationProvider : chargingStationAuthorizationProviders ) { AuthorizationProvider provider = providers . get ( authorizationProvider ) ; if ( provider != null ) { IdentifyingToken validatedToken = provider . validate ( token , chargingStationId ) ; if ( validatedToken . isValid ( ) ) { return validatedToken ; } } } return token ; }
Validates the token with the configured authentication providers for the charging station, as soon
as one provider provides valid authorization this will be the result.

@param token identifying token for which authorization is required
@return validated IdentifyingToken