Skip to content

Use java.nio.charset.StandardCharsets instead of com.nimbusds.jose.util.StandardCharset in persistence msal4extensionsΒ #995

@HerrDerb

Description

@HerrDerb

In the persitence msal4extensions, a unusual StandardCharset is used instead of the default java.nio.
This causes issues e.g. during native build.

Error: Discovered unresolved type during parsing: com.nimbusds.jose.util.StandardCharset. This error is reported at image build time because class com.microsoft.aad.msal4jextensions.PersistenceTokenCacheAccessAspect is registered for linking at image build time by command line and command line.
Error encountered while parsing com.microsoft.aad.msal4jextensions.PersistenceTokenCacheAccessAspect.afterCacheAccess(PersistenceTokenCacheAccessAspect.java:143) 

There seems no reason to use com.nimbusds.jose.util.StandardCharset over java.nio. Therefor the import should be changed to avoid dependency issues.

https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/b6f54ca13957b8d9e20823bf5c776de543518fa7/msal4j-persistence-extension/src/main/java/com/microsoft/aad/msal4jextensions/PersistenceTokenCacheAccessAspect.java#L127C84-L127C99

Current workaround is to provide a stupid implementation with the same classpath for native build:

package com.nimbusds.jose.util;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class StandardCharset {

    public static Charset UTF_8 = StandardCharsets.UTF_8;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority items, should be done after P1persistence-packageFor issues related to the msal4j-persistence-extension package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions