Showing results for 
Search instead for 
Did you mean: 

CdsRuntimeError - While implementing Custom UserInfoProvider


errorlog.txtIn our application, we are implementing Instance based Authorization( so that user can have access only to respective organization records. To implement instance based authorization, we get organization Id via SAML attributes (attribute : sapBpidOrg).

The actual problem is with values obtained from XSUAA UserInfo class for the attribute “sapBpidOrg”. For example, user has been associated to organization 12345, the value obtained after decoding XSUAA UserInfo “[12345]” but the expected value [“12345”].

Therefore, we are trying to modify attribute(“sapBpidOrg”) value obtained from XSUAA UserInfo by overriding the class UserInfoProvider. However, we are stuck with error “Error creating bean with name '': Invocation of init method failed;”.

    UserInfo userInfo;

    CdsRuntime cdsRuntime;

    public UserInfo get() {
        LOG.debug("User Information Statement {}", cdsRuntime.getProvidedUserInfo().getAttributeValues("uid"));
        cdsRuntime.requestContext().privilegedUser().run(context -> {
            LOG.debug("User Information {}", context.getUserInfo().getAttributeValues("uid"));
        List<String> value = new ArrayList<>();
        final Pattern pattern = Pattern.compile("\\[[^\\]]*\\]");

        if (userInfo != null) {
            cdsRuntime.requestContext().privilegedUser().run(context -> {
                List<String> organisationId = userInfo.getAttributeValues("sapBpidOrg");
                List<String> xtractedVals = null;

                if (organisationId != null) {
                    for (String customerId : organisationId) {

                        if (pattern.matcher(customerId).matches()) {
                            String str = customerId.substring(1, customerId.length() - 1);
                            xtractedVals = Stream.of(str.split(",")).collect(Collectors.toList());


                    LOG.debug("User roles of user [{}] from db: {}", userInfo.getName(), value);

        final ModifiableUserInfo modifiableUserInfo = userInfo.copy();
        modifiableUserInfo.setAttributeValues("sapBpidOrg", value);

        LOG.debug("Modified attributes of user [{}]: {}", userInfo.getName(),


Accepted Solutions (0)

Answers (0)